Different title and H1 tag?

In Hugo is it possible to have a different H1 and title tag? On my pages I’m currently using the following code:

title = “ARTICLE NAME”

This makes the title tag and h1 the same. I’d like to be able to have them be different. Is this possible?

I’m new to using Hugo but I’m loving it so far!

1 Like

You can have as many user-defined variables as you would like in your front matter that can be referenced with .Params in your templating. You can read more about this in the documentation too.

.Title just happens to be one of the required fields in Hugo.

If you want to add something different, you have a lot of freedom to do so in your templating layer.

For example…

title = "My Article"
seotitle = "My SEO Title"

Then in your template

<title>{{ with .Params.seotitle }}{{.}}{{else}}{{.Title}}{{end}} </title>
2 Likes

Thank you! I’ve got that figured out and setup now, it was much easier than I imagined it would be.

Really appropriate your help! +1:

1 Like