Frontmatter is configruation section at the beginning of markdown files, it uses two --- wrap (different data uses different symbol wrap, YAML is recommended) to define posts’ basic information, or cover some parameters in hugo.yaml. Every archetypes has common and unique frontmatters.

If you don’t know what is archetypes, see Archetypes.

Default Archetypes

Default archetypes is used to generate posts and other content for which no content template is defined.

Basic

YAML
 1---
 2# required
 3title: "Post Title"
 4date: 2025-06-13
 5# Optinal
 6description: "Post description"
 7draft: false
 8categories: ["categories 1", "categories 2"]
 9tags: ["tags 1", "tags 2"]
10slug: "custom-url"
11cover: ""
12---
Click to expand and view more

If you don’t matter SEO, you can use the theme archetypes to auto generate slug, it generates a random 7-digit string.

YAML
1slug: { { substr .File.UniqueID 0 7 } }
Click to expand and view more

Other frontmatter

Default(Posts) archetypes also support other frontmatters, these configurations involve some features of the theme, usually configured in hugo.yaml, but you can also modify the overrides in the frontmatter.

YAML
 1# math formula
 2katex:
 3  enabled: true
 4  delimiters:
 5    - left: $$
 6      right: $$
 7      display: true
 8    - left: $
 9      right: $
10      display: false
11
12# charts
13mermaid:
14  enabled: true
15
16# related posts
17showRelated: true
18
19# posts license
20post:
21  license:
22    show: true
23    author: "Hugo Narrow"
24    name: "CC BY-NC-SA 4.0"
25    description: "This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License. Please attribute the source, use non-commercially, and maintain the same license."
26    url: "https://creativecommons.org/licenses/by-nc-sa/4.0/"
27    displayName: "CC BY-NC-SA 4.0"
Click to expand and view more

Projects Archetype

The projects archetype is used to generate project files. The basic frontmatter parameter are the same as the default archetype. There are also unique frontmatter. The following are the unique parameters of the projects archetype:

YAML
1cover: ""
2featured: false
3url: "www.example.com"
4status: "completed" # Options: completed, in_progress, planning
Click to expand and view more

Copyright Notice

Author: Hugo Narrow

Link: https://hugo-narrow-docs.vercel.app/docs/frontmatter/

License: CC BY-NC-SA 4.0

This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License. Please attribute the source, use non-commercially, and maintain the same license.

Start searching

Enter keywords to search articles

↑↓
ESC
⌘K Shortcut