HUGO
News Docs Themes Community GitHub

Keywords

Returns a slice of keywords as defined in front matter.

Syntax

PAGE.Keywords

Returns

[]string

By default, Hugo evaluates the keywords when creating collections of related content.

---
keywords:
- tuna
- sriracha
- nori
- rice
title: How to make spicy tuna hand rolls
---
+++
keywords = ['tuna', 'sriracha', 'nori', 'rice']
title = 'How to make spicy tuna hand rolls'
+++
{
   "keywords": [
      "tuna",
      "sriracha",
      "nori",
      "rice"
   ],
   "title": "How to make spicy tuna hand rolls"
}

To list the keywords within a template:

{{ range .Keywords }}
  {{ . }}
{{ end }}

Or use the delimit function:

{{ delimit .Keywords ", " ", and " }} → tuna, sriracha, nori, and rice

Keywords are also a useful taxonomy:

taxonomies:
  category: categories
  keyword: keywords
  tag: tags
[taxonomies]
  category = 'categories'
  keyword = 'keywords'
  tag = 'tags'
{
   "taxonomies": {
      "category": "categories",
      "keyword": "keywords",
      "tag": "tags"
   }
}