Archetypes is template for new content, located at ~/archetypes. A content file consists of frontmatter and markup. Frontmatter can be TOML, YAML, JSON.

~/archetypes/default.md is the default archetype. Hugo Narrow include two archetypes:

  • archetypes/default.md: default archetype, used for posts and others.
  • archetypes/projects.md: project archetype, used for project files.

Create a new post

Use the following command to create a new post named my-first-post with the default archetype:

BASH
1hugo new content posts/my-first-post.md
Click to expand and view more

Create a new project

Use the following command to create a new project named my-first-project with the project archetype:

BASH
1hugo new content projects/my-first-project.md
2# use `--kind` parameter
3hugo new content --kind projects projects/my-first-project.md
Click to expand and view more

Custom archetypes

If you need create your own archetype, create a file at the root folder of the site: ~/archetypes/default.md

Hugo follows the lookup order for archetypes:

  1. archetypes/posts.md
  2. themes/hugo-narrow/archetypes/posts.md
  3. archetypes/default.md
  4. themes/hugo-narrow/archetypes/default.md

If none of these exists, Hugo uses a built-in default archetype.

Copyright Notice

Author: Hugo Narrow

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

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