HUGO
News Docs Themes Community GitHub

Params

Returns a map of custom parameters as defined in the front matter of the given page.

Syntax

PAGE.Params

Returns

maps.Params

With this front matter:

date: 2023-10-17T15:11:37-07:00
params:
  author:
    email: jsmith@example.org
    name: John Smith
  display_related: true
title: Annual conference
date = 2023-10-17T15:11:37-07:00
title = 'Annual conference'
[params]
  display_related = true
  [params.author]
    email = 'jsmith@example.org'
    name = 'John Smith'
{
   "date": "2023-10-17T15:11:37-07:00",
   "params": {
      "author": {
         "email": "jsmith@example.org",
         "name": "John Smith"
      },
      "display_related": true
   },
   "title": "Annual conference"
}

The title and date fields are standard parameters—the other fields are user-defined.

Access the custom parameters by chaining the identifiers:

{{ .Params.display_related }} → true
{{ .Params.author.name }} → John Smith

In the template example above, each of the keys is a valid identifier. For example, none of the keys contains a hyphen. To access a key that is not a valid identifier, use the index function:

{{ index .Params "key-with-hyphens" }} → 2023