Featured Image

The featured-Image shortcode displays an image you set in the image Front-Matter. Note that when the image front-matter is set, the image appears in a post summary list.

How to use

You can use the {{< featuredImage >}} shortcode anywhere in your post. The image path is relative to the static folder. So, in the below case, the image is in the root/static/images/mountain.jpg.

1
2
3
4
5
6
7
8
9
---
title: ""
...
image: "images/mountain.jpg"
...
---

{{< featuredImage >}}
...

You can also set optional params like this. {{< featuredImage alt="featured image" width=50 height=50 >}}

1
2
3
4
5
6
7
8
---
title:
...
image: images/my-featured-image.png
---

{{< featuredImage alt="featured image" width=50 height=50 >}}
...

关于站长

我叫朱安邦,本站的站长。如果您对网站有什么好的建议,欢迎在 Twitter 上与我交流

本文目录