Skip to content

Access frontmatter data elsewhere #3209

Closed Answered by pdehaan
thatshubham asked this question in Q&A
Discussion options

You must be logged in to vote

Not sure if post would be defined in your layout, outside the scope of the home page's for..in loop.
Wouldn't it just be {{ img }} in the layout and not try setting it:

-       {% set img = post.data.img %}
        <img src="{{ img }}" class="w-screen object-cover"   alt="" />

Although that wouldn't work if you use that layout but didn't happen to have img frontmatter for that page.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@thatshubham
Comment options

Answer selected by thatshubham
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants