You should check Hugo Custom Output formats.
All you have to do is create a new mediatype and custom output formats for your _headers
file and then add the newly added output format to your homepage:
# In your config file
# 1. Create Media Type
mediaTypes:
text/netlify:
delimiter: ''
suffixes:
- ''
# 2. Create Output Format
outputFormats:
headers:
baseName: _headers
isPlainText: true
mediatype: text/netlify
notAlternative: true
# 3. Add to homepage
outputs:
home:
- HTML
- headers
Last you want to create a template file for your headers, for the homepage it should live at layouts/index.headers
from there you can hardcode your headers or dynamically generate them using Go Template…