Sharing front matter variables within different content

Hi all,

In the process of designing a site but wanted to know if the following is possible:

Let’s say I have two content types, 1) blog 2) news
Can Hugo share front matter between the two content types? So if blog has a front matter variable called “blog_foo” can I call that variable in news/list.html?

I will get a repo done as well but just wanted to hear of this even makes sense…

Many thanks in advance

Assuming blog is located at content/blog/_index.md then you can do:

{{ (site.GetPage "blog").Params.blog_foo }}

Oh that’s interesting, and would that work for content in the blog folder? So blog/post-1/index.html I am not near a computer now but will try your tag tomorrow. Really appreciate the help @zwbetz!)

Yep would work for content too. Just tweak it like

(site.GetPage "blog/post-1")
1 Like

This worked!) Thank you so much !