In the front matter for a paginated section’s _index.md I added an extra data field:
+++
paginate_by = 50
sort_by = "weight"
[extra]
hero_text = "Hello this is my text"
+++
I’ve tried accessing this field in a template as:
section.extra.hero_text
paginator.extra.hero_text
section.hero_text
but none of those work. Is this not how that’s supposed to be accessed? The documentation mentions an extra field for sections so I thought this should work.
Hey sirodoht, your comment helped a lot, thanks. It feels a bit odd though having to add [extra] to all posts. What if that extra data is just for a subset of pages and not all pages. Are there other ways to achieve this?
It seems you’re close! Try accessing the extra field like this in your template:
html
{{ section.extra.hero_text }}
If that still doesn’t work, ensure that your _index.md is being treated as a section and not a regular page. Also, double-check for any typos in your front matter.