Page Objects & YAML Front Matter

My code for post-item.html.twig can be found here

So I am attempting to show the first image in the blog post on the screen above, hence, I have included {% set blog_image=|first %}. However, I am unsure of how to call on this in the , and no image is showing up.

Moreover, it seems that there is something wrong with my YAML Front Matter as I specify the Page Author {{ }}, however when it displays on the site (as shown in the image) it shows nothing, despite me adding an author in the

Any help would be fantastic!

Due to image restrictions, here is the information I wish to change.

as you are in a for loop, you have to use the variable you defined, in this case post.


{% for post in page.children %}
{{post.title }}
{{ }}
{{|first }} {# will display the img tag #}
<img src="{{|first.url}}"
{% endfor %}

Also you have some kind of weird syntax here:

<img src="$blog_image.url" alt=""/>

Where does this come from?

Hope it helps,

1 Like

Ahh Perfect! Thank you for that! You’ve fixed all my problems!