I have a contact page (contact.md) and an about page (about.md). I want them to have the same header and footer but not the same “main” element because this element will have different structure and styles.
Instead of creating a separate layout for each, how would I go about having a shared layout and “insert” the contents in the middle?
Have a read about base templates here: https://gohugo.io/templates/base/
How do I tie it all together?
I have layouts/page/baseof.html
Frontmatter contains type: page.
I defined blocks in layout/partials/about.html and layout/partials/contact.html
I want baseof.html to get the blocks from these files somehow. How to achieve this?
My two cent is create
layouts/_default then add the the layout for custom type inside
contact.html #layout for contact page
about.html #layout for about page
define all the block then use different main section for each layout.
the last step add
layout in front matter of each page content.
This is what I ended up doing