Writing

Stack uses Hugo's Page Bundle feature to manage post images and optimize them.

The featured image of each post must be placed under the same folder as the Markdown file, as the example below:

---
title: "Random post title"
description: "Lorem Ipsum"
date: "2020-08-10 01:00:00+0200"
slug: "example-post"
image: "cover.jpg"
---

image slug is used to specify the filename. The folder structure should be like:

+---Example post
| cover.jpg
| example_image.jpg
| index.md

Although the featured image could be an external image, it's not recommended because Stack won't be able to get it's width and height attribute, nor generate appropriate thumbnails.

Insert image

It's recommended to insert post images in the same way, using the Page Bundle feature. By doing that, Stack can generate different image sizes and delivery the appropriate one using srcset feature from HTML5.

Also, the image's width and height attributes are added automatically to avoid the layout shift.

See /layouts/_default/_markup/render-image.html

For example:

+--- Example post
| cover.jpg
| Design-V1.jpg
| Design-V2.jpg
| index.md

[index.md](http://index.md) content:

---
title: "Example post"
description: "Page description"
date: "2020-08-10 01:00:00+0200"
slug: "example-post"
image: "cover.jpg"
categories:
- Blog
tags:
- Hugo
- Stack
---
![Image 1](Design-V1.jpg)
![Image 2](Design-V2.jpg)

The synaxis used to insert gallery comes from Typelog. Thanks to Lepture for permission..

![Image 1](https://image/src1) ![Image 2](https://image/src2)
![Image 3](https://image/src3) ![Image 4](https://image/src4)