Setting Permalinks for categories & tags

I’m encountering an issue with Hugo’s built-in taxonomies, and I can’t seem to get them to move as expected. My custom taxonomies, like course-topic, work fine, but the built-in category and tag taxonomies do not.

The Issue

In my public folder, I’m seeing all 40 categories listed under /categories/:slug/, but I also see 11 of them listed under /resources/categories/:slug/. This duplication is confusing.

What I’ve Tried

  1. I created markdown files under /categories/ for each category since this is how the built-in taxonomies are supposed to work, but I can’t figure out how to move the data location.
  2. None of these markdown files have aliases or URL overrides.

Configuration Details

Here’s the relevant part of my hugo.yaml:

taxonomies:
  category: categories
  tag: tags
  course-topic: course-topics
  course-vendor: course-vendors
  course-learning-experience: course-learning-experiences
  customer-industry: customer-industries
  delivery-audience: delivery-audiences
  people-ability: people-abilities
  resourceTypes: resourceTypes

permalinks:
  taxonomy:
    categories: "/resources/categories/:slug/"
    tags: "/resources/tags/:slug/"
    marketing: "/marketing/:slug/"
    resourceTypes: "/resources/types/:slug/"
    delivery-audiences: "/capabilities/audiences"
    course-topics: "/capabilities/training-courses/course-topics"
    course-vendors: "/capabilities/training-courses/course-vendors"
    course-learning-experiences: "/capabilities/training-courses/course-learning-experiences"
    customer-industry: "/company/customers/industry"
    people-abilities: "/company/people/abilities"
  term:
    categories: "/resources/categories/:slug/"
    tags: "/resources/tags/:slug/"
    marketing: "/:slug/"
    resourceTypes: "/resources/types/:slug/"
    delivery-audiences: "/capabilities/audiences/:slug/"
    course-topics: "/capabilities/training-courses/:slug/"
    course-vendors: "/capabilities/training-courses/:slug/"
    course-learning-experiences: "/capabilities/training-courses/:slug/"
    customer-industry: "/company/customers/:slug/"
    people-abilities: "/company/people/abilities/:slug/"
  page:
    resources: "/:sections/:slug/"
    course: "/:sections/:slug/"

Expected Behaviour

I expect all category taxonomies to appear only under /resources/categories/:slug/, not under both /categories/:slug/ and /resources/categories/:slug/.

Additional Context

  • My custom taxonomies like course-topic and customer-industry behave as expected.
  • The built-in category and tag taxonomies ignore the permalinks settings.

What am I missing here? Any insights would be appreciated!

note: my repo is on nkdAgility/NKDAgility.com and the site is built from the root locally using hugo server --source site --config hugo.yaml,hugo.local.yaml

Have you deleted the contents of the publishDir after making changes to your permalinks configuration? Hugo does not clear the public directory before building your site; after the build your public directory may contain extraneous files from a previous build.

git clone --recurse-submodules https://github.com/nkdAgility/NKDAgility.com
cd NKDAgility.com
hugo --source site --config hugo.yaml,hugo.local.yaml

Then count:

ls -l public/categories | wc -l    # 51 entries (includes index.html)
ls -l public/resources/categories  # ls: cannot access 'public/resources/categories': No such file or directory
1 Like

I have cleared the contents. no effect. I still get some in public/resources/categories and all in public/categories

It also sees the .md files in the categories and tags folders as “pages” and not “terms”

UPDATE: I fixed the “pages” bug… this may fix the rest

Yup… this issue looks like I was doing /content/catorgories/my-name.md instead of /content/catorgories/my-name/_index.md

Changing all of the categoris and tags fixed everyting.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.