Getting front matter params from .Params doesn't work

Hi, I’m a complete beginner in creating websites and am trying to create my own using Hugo.
However I ran into a problem: I’d like to include some parameters I defined in the front matter of my blog posts in the of the document, but nothing gets added.

This is how I’m getting the parameters in my partial layout:


{{ with .Params "ogtype" }}
  <meta name="og:type" content="{{ . }}">
{{ end }}

Note: i also tried with .Param
Furthermore, I also tried using other parameters which are predefined but they also don’t work like:

{{ with .Title }}
  <title>{{ . }} | {{ site.Title }}</title>
  <meta property="twitter:title" content="{{ . }} | {{ site.Title }}">
{{ else }}
  <title>{{ site.Title }}</title>
{{ end }}
{{ with .Description }}
  <meta name="description" content="{{ . }}">
{{ end }}

But once again it doesn’t work (but site.Title works)…

This is how I define the parameter in my front matter:


title: My blog post
date: 2022-12-07T19:33:08+01:00
lastmod: 2022-12-19T14:51:54.603Z
draft: true
ogtype: article
description: My first blog post
# My first blog post

Finally, by ‘not working’, I mean that the “with” test doesn’t seem to find these params (but I don’t get any errors in the console).
Sorry for my dumb question I just couldn’t find nor understand any answer to it…

hugo env:

hugo v0.108.0-a0d64a46e36dd2f503bfd5ba1a5807b900df231d+extended windows/amd64 BuildDate=2022-12-06T13:37:56Z VendorInfo=gohugoio

The website is also on a public Github repository



with $.Params.ogtype

1 Like


{{ partial "head-meta.html" }}


{{ partial "head-meta.html" . }}
1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.