Skip to content

Commit cafc76e

Browse files
committed
feat: add support for image.show_image_in_post
1 parent 65f960c commit cafc76e

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

_layouts/post.html

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,15 @@ <h1 data-toc-skip>{{ page.title }}</h1>
4545
{%- capture lqip -%}lqip="{{ page.image.lqip }}"{%- endcapture -%}
4646
{% endif %}
4747

48-
<div class="mt-3 mb-3">
49-
<img {{ src }} {{ class }} {{ alt }} w="1200" h="630" {{ lqip }}>
50-
{%- if page.image.alt -%}
51-
<figcaption class="text-center pt-2 pb-2">{{ page.image.alt }}</figcaption>
52-
{%- endif -%}
53-
</div>
48+
{% if page.image.show_image_in_post != false %}
49+
<div class="mt-3 mb-3">
50+
<img {{ src }} {{ class }} {{ alt }} w="1200" h="630" {{ lqip }}>
51+
{%- if page.image.alt -%}
52+
<figcaption class="text-center pt-2 pb-2">{{ page.image.alt }}</figcaption>
53+
{%- endif -%}
54+
</div>
55+
{% endif %}
56+
5457
{% endif %}
5558

5659
<div class="d-flex justify-content-between">

_posts/2019-08-08-write-a-new-post.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,7 @@ image:
227227
```
228228

229229
Note that the [`media_subpath`](#url-prefix) can also be passed to the preview image, that is, when it has been set, the attribute `path` only needs the image file name.
230+
Additionally, `image.show_image_in_post` can be added and set to `false` which will hide the image from being displayed at the top of the post. However, the image will still be displayed on the homepage next to the post and whenever sharing the post in social media. `image.show_image_in_post` is `true` by default.
230231

231232
For simple use, you can also just use `image` to define the path.
232233

0 commit comments

Comments
 (0)