I could not find, is there variable for current layout?
I’m setting layout in frontmatter for some pages and for this layout I want do add/remove some code in html head section, which is partial and called for all templates.
I could not find, is there variable for current layout?
I’m setting layout in frontmatter for some pages and for this layout I want do add/remove some code in html head section, which is partial and called for all templates.
There is no variable for the current layout. I tend to use just a comment on ALL (yeah, sorry) layout files to know where I am:
{{ "<!-- filename here -->" | safeHTML }}
There is also no way to get the current layout file used to my knowledge. If you minimise in production and don’t minimise in development mode then the comments are gone when the site is live, but you have them on localhost:1313.
You can access the front matter value via .Page.Params.layout
.
Thanks, I forget about this way
This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.