Skip to content
Grav 2.0 is officially stable. Read the announcement →

Community guidelines

Please keep discussions civil and on-topic. Repeated violations may lead to a temporary ban.

Archive

Custom header fields

Started by Muut Archive 12 years ago · 4 replies · 487 views
12 years ago

In order to configure a template, I would like to add properties to the header section of a (blog) page. When I add foo: bar and add {{ page.header.foo }} into the template, nothing is shown, but when I add, say, {{ page.header.pagination }} into the template 1 is shown (the blag has pagination:true). Is there a way to add custom header fields? The docs are unclear.

The significance of these headers is that Grav does not use them by default, they are only read by the [ in this case ] sitemap plugin to determine how often this particular page is modified and what its priority should be.
Any page header such as this should be documented, and generally there will be some default value that will be used if the page does not provide it

Does this mean custom headers are not provided to grav at all? How or where should this be documented? Does this mean I can only configure templates if I build a plugin?

12 years ago

Mmm to me working fine. You need to check where you write the variable, you can post the template and the page where you edit? On pastie or gits it's fine to see the whitespace :)

12 years ago

Yeah. Ive been mucking about in an editor with too many similarly named files staring at the wrong output. But thanks. Your comment pointed me towards the light at the end of the tunnel.

Suggested topics

Topic Participants Replies Views Activity
Archive · by Deleted User, 9 years ago
0 1296 9 years ago
Archive · by Muut Archive, 9 years ago
2 890 9 years ago
Archive · by Muut Archive, 9 years ago
2 4019 9 years ago
Archive · by Muut Archive, 9 years ago
1 2894 9 years ago
Archive · by Muut Archive, 9 years ago
3 1078 9 years ago