You have a few issues with your setup.
I’ll point them all out to help you since you’re very new with Hugo, but please do study the Docs.
First of all in your config you have:
[taxonomies]
destination = "destination"
[permalinks]
destination**s** = "/blog/destination/:slug/"
Remove the erroneous s to configure your taxonomy’s permalinks.
Then in your template under /_default/single.html
The following is what throws the console error:
{{ range .Params.destination }}
<a href="{{ "/destination/" | relLangURL }}{{ . | urlize }}">{{ . }}</a>
{{ end }}
You don’t need to use range
because there is nothing to go through.
Instead you need to use with
. Pay attention to with
it’s one of the tersest functions that Hugo has and you will be using it very often since it’s what we use to check if something exists in a template.
Also you need to change the link construct you have above because with what you have you will get a link that points to /blog/destination/
and that is not what you want -I think-.
So change it to <a href="/blog/destination{{ . | urlize | relLangURL }}">{{ . }}</a>
Note the dot after "/blog/destination/"
that will render the word Japan. Also note how I’ve piped both urlize
and relLangURL
. You can pipe several functions at once in Hugo.
So to put it all together your code block needs to become:
{{ with .Params.destination }}
<a href="/blog/destination{{ . | urlize | relLangURL }}">{{ . }}</a>
{{ end }}
One last thing. In the front matter of your posts include the following only once (you have it twice in one of your posts)
destination: "Japan"
Note that I have removed the angle brackets. These are meant for an array and I don’t think that you need an array here since each content will have one destination.
Do the above and you will get what you want also pagination works.
And if you feel like it leave a comment to the web page you linked to above and let the author know that there is a native way to configure Taxonomy Permalinks in Hugo without breaking pagination.