Skip to content

Hugo Taxonomy Error Fix

DodaTech Updated 2026-06-24 1 min read

In this tutorial, you'll learn about Hugo Taxonomy Error Fix. We cover key concepts, practical examples, and best practices.

The Problem

WARN: 2024/01/15 10:00:00 found no layout file for "taxonomy"

Hugo cannot find a layout for taxonomy pages. Taxonomy pages (tags, categories) require specific layout templates.

Wrong

Hugo config with no taxonomy definition:

[taxonomies]
  # empty or missing

Output: taxonomy pages return 404 or use default list layout.

Define taxonomies in your config:

[taxonomies]
  tag = "tags"
  category = "categories"

Create a taxonomy list template at layouts/taxonomy/list.html:

{{ define "main" }}
<h1>{{ .Title }}</h1>
<ul>
{{ range .Pages }}
    <li><a href="{{ .RelPermalink }}">{{ .Title }}</a> ({{ len .Pages }})</li>
{{ end }}
</ul>
{{ end }}

Output: a list of all tags with post counts.

Prevention

  • Define taxonomies explicitly in your config file
  • Create layouts/taxonomy/list.html for taxonomy listing pages
  • Create layouts/taxonomy/term.html for individual taxonomy term pages
  • Use disableKinds: ["taxonomy", "term"] to turn off unwanted taxonomy pages

Common Mistakes with taxonomy error

  1. Non-exhaustive pattern matches that compile with warnings then crash at runtime
  2. Misunderstanding that String is [Char] with poor performance for large text operations
  3. Using foldl instead of foldl' causing stack overflow on large lists

These mistakes appear frequently in real-world HUGO code. DodaTech's contributors have identified these patterns through analysis of open-source projects and production systems.

Practice Exercise

Write a pure function that safely divides two integers using Maybe, then test it with edge cases like division by zero and negative numbers.

This exercise reinforces the concepts covered in this guide. Try implementing it before checking online solutions.

FAQ

### How do I add tags and categories to Hugo?

Add tags: [tag1, tag2] and categories: [cat1] to your page frontmatter. Define [taxonomies] tag = "tags" category = "categories" in your config.

Why does my Hugo taxonomy page show "Page Not Found"?

You need either a layouts/taxonomy/term.html or a layouts/_default/list.html template. Hugo looks for taxonomy-specific layouts first, then falls back to the default list template.

Can I customize the URL structure for taxonomies?

Yes. Use [permalinks.taxonomies] in your config, e.g. tag = "/topic/:slug/" changes /tags/hugo/ to /topic/hugo/.

Built by the developers of DodaTech

Doda Browser, DodaZIP & Durga Antivirus Pro