Determine Which File is Loading a Layout File

What are want to check is whether the current page has layout of post or not. Assuming you have set the layout to be post on each post or on config defaults (much more efficient to apply for all posts).

So use a page variable

page.layout

Docs - page variables

And check against your value

{% if page.layout == 'post' %}
1 Like