picocms / Pico

Pico is a stupidly simple, blazing fast, flat file CMS.
http://picocms.org/
MIT License
3.81k stars 616 forks source link

Problem Using Custom Meta #589

Closed cssdipen closed 3 years ago

cssdipen commented 3 years ago

I am not able to access custom meta in my .twig file

about.twig >>

{{ pages.index.meta.about_text }}

about.md>> about_text: This is about us text

Output >> about_text: This is about us text

It should be in h2 tag with this text "This is about us text"

mayamcdougall commented 3 years ago

Hi there.

I believe you’re going to want to use:

{{ pages['index'].meta.about_text }}

When accessing a specific page, index in this case is a Key in the pages array*, not a property of pages itself.

* (I have a bad habit of calling everything an “array”. Technically in Twig, it’s a “Hash”, but it’s functionally the same as a “Dictionary” in many programming languages. Each entry is identified by a unique string, or “Key”.)

Hopefully this helps you out. I’m just waking up, so it’s possible I’ve overlooked something here.

Feel free to follow up on this thread with any other support questions you might have. 😉

github-actions[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in two days if no further activity occurs. Thank you for your contributions! :+1: