1 min read

Insert page frontmatter into your Hugo layout

Learn how to insert page frontmatter into your Hugo layout.
Insert page frontmatter into your Hugo layout

I recently switched over to Hugo and hadn't had time to read through the documentation by the time I was updating one of my layouts.

I was trying to update the descriptions of each of the posts on my homepage.

I did a quick search and found in Hugo's documentation Hugo page variables that you can use .Params.page-variable-name to insert page variable frontmatter into your page layout.

My default layout from my Soho theme had .Summary, which is an automatically generated summary by Hugo.

But I need my frontmatter description field to be displayed instead.

To load this frontmatter into my page, all I needed to do was insert .Params.description into my layout.

This would insert it into my list layout on my homepage with the proper description I set instead of the auto-generated summary.