HUGO

I can't show custom tags in hugo theme mini

Hi,

Now I’m using the hugo theme mini and I want to add my custom tags. I decided use the custom tag labels. So my permalink is something like that: blog.com/labels/new-entry

But… changes don’t work.

Here the changes what I did:

  • Added taxonomies option in config.yaml:
    taxonomies:
      category: categories
      tag: tags
      label: labels
    
  • Modified layouts/_default/taxonomy.html, line 24:
    <a href="{{ "labels/" | absURL }}{{ . | urlize }}">{{ . }}</a>
    
  • Modified layouts/_default/list.html, line 24:
    <a href="{{ "labels/" | absURL }}{{ . | urlize }}">{{ . }}</a>
    
  • Modified layouts/_default/single.html, line 35:
    <a href="{{ "labels/" | absURL }}{{ . | urlize }}">{{ . }}</a>
    
  • Modified layouts/_default/terms.html, line 8:
    <a href="{{ "labels/" | relURL }}{{ $value.Name | urlize }}">
    
  • Added in the front matter in the post the next:
    ---
    author: me
    title: New post
    date: 2021-10-10
    labels:
    - label1
    - label2
    ---
    

After the modifications tags don’t appear in the bottom of the post and the same situation in the the Archive list.

What happened here?

as from layouts example, you need to modify start from the with block:

example from:

Modify it to:

++{{ with .Params.labels }}
--{{ with .Params.tags }}
    <div class="tags">
        {{ range . }}
++       <a href="{{ "labels/" | absURL }}{{ . | urlize }}">{{ . }}</a>
--       <a href="{{ "tags/" | absURL }}{{ . | urlize }}">{{ . }}</a>
        {{ end }}
    </div>
{{ end}}