nunocoracao / blowfish

Personal Website & Blog Theme for Hugo
https://blowfish.page
MIT License
1.53k stars 421 forks source link

Ability to access article frontmatter / `Page` object in `extend-head.html` #1781

Open tigattack opened 1 month ago

tigattack commented 1 month ago

Is your feature request related to a problem? Please describe.

As far as I'm aware, it's currently not possible to access the current page's Page object (and by extension, any page parameters from frontmatter) in extend-head.html. This makes it impossible to perform any page-level logic.

For example, in my use case, I wish to add something in my extend_head.html which relies on a condition such as if page.HasShortcode "foo_bar", but (again, as far as I'm aware?) this is not possible with the way extend-head.html is currently implemented, since Blowfish only passes .Site into the partial.

Describe the solution you'd like

It would open up a lot of possibilities and be super handy to be able to access the current page from extend-head.html.

Describe alternatives you've considered

Given what I wish to do, I don't believe there is any alternative, but I'm open to correction!

Additional context

This is the same issue as #1425, which appears to be have been prematurely closed due to a misunderstanding.

Erwane commented 2 weeks ago

Have same problem but looks like the {{ page }} variable contain Page object

# example
{{ page.Resources }}