Custom Taxonomies are not being outputted [Solved]

I have defined my taxonomies in my configuration file

[taxonomies]
    articleType = "articleTypes"
    discipline = "disciplines"
    tag = "tags"

and tried to output the terms

  {{  range $name, $taxonomy := .Site.Taxonomies.disciplines }}
        {{ $name }}
    {{ end }}
    <hr />
    {{  range $name, $taxonomy := .Site.Taxonomies.tags }}
        {{ $name }}
    {{ end }}
    <hr />
    {{  range $name, $taxonomy := .Site.Taxonomies.articleType }}
        {{ $name }}
    {{ end }}

However, only the tag terms are shown. The other 2 taxonomies output nothing.

Any idea why?

EDIT: Looking at the generated files, it seems only the tags taxonomy is being generated. My assumption is that you can define custom taxonomies in Hugo and it will be generated like the default ones(tags, categories). Am I wrong?

Are you regenerating the files after changing the config? If you’re just running hugo server, you’ll have to restart it after every config change.

Yeah I am using hugo server -w

I finally found the problem. In the front matter, you have to define the custom taxonomies by their plural name, not by their singular name.

As @summerset mentioned, you still have to stop Hugo and restart it every time you change the configuration file. That’s the one file that Hugo will never pick up changes on while running in --watch mode.

where’s the solution to this? I’m having the same issue where my custom taxonomy isn’t showing:

.md
apps: [“Google Docs”, “Trello”, “MailChimp”]

config.toml
[tanoxomies]
tag = "tags"
category = "categories"
app = “apps”

{{ range $.Site.Taxonomies.apps.ByCount }} {{ .Name }} {{end}}

If you use the --verbose switch on hugo server does it give any details?

You should use straight double quotes, not curly quotes. I cannot tell if what you pasted is an artifact of copy-paste or, the way you actually have it.

Thanks for replying. I’m using straight double quotes.

hugo --verbose
INFO 2018/02/19 23:47:42 found taxonomies: map[string]string{“tag”:“tags”, “category”:“categories”}

but it’s ignoring the “apps” taxonomy.

This works OK when I test it with tags
{{ range $.Site.Taxonomies.tags.ByCount }} {{ .Name }} {{end}}

I’m using Hugo v0.36

Did you restart hugo server?

Did a quick test. On changing my config.toml to include three taxonomies, I had to restart hugo server to get it to stick. Once I did, the map that is shown with --verbose includes all the taxonomies, and I can access.

I did the same and even rebooted my PC; nothing worked. Here’s link to my repo. Any help would be appreciated.

https://github.com/kenold/appshabit

Found it. You spelled taxonomies as tanoxomies. :smile: @kenold

Thank you so much @RickCogley . :man_facepalming:

1 Like

No problem. I have some dyslexia so this sort of thing happens to me a lot. :slight_smile: