HUGO

Duplicate pages in Taxonomy when used with slashes

I have a page with the following head section:

---
title: Here
locations:
 - Here
 - Here/There
---

###here 

Then, I have a taxonomy list.html layout, as:

{{ range .Pages }}
<li>
    <a href="{{ .Permalink }}">{{ .Permalink }} - {{ .Title }}</a>
</li>
{{ end }}

My outputs are as follows:

Screen Shot 2020-10-14 at 17.09.49

and as:
Screen Shot 2020-10-14 at 17.09.12

and as:
Screen Shot 2020-10-14 at 17.10.22

As we can see, in the second screenshot, it produces a duplicate where both items are linking to the same page. It appears that Hugo takes the taxonomy here and here/there to be both equal to here. This also overcounts the number of unique items associated with a taxonomy. Can it be prevented?

I don’t think it can be.

However, you might be wrong about this. According to me, what’s really happening is, the browser is showing the wrong page. In web standards a forwards slash / means change in directory. So, for the browser here/there is translating to directory named there inside the directory named here. Something like this:

|Root
   |-Here
     | -There

So, from the looks of it, what you’re seeing is the list page located at there. This is probably not a Hugo problem, it’s just the fundamental way of how the web works. Changing that would not be a good idea.

Again, this is just my little knowledge and understanding. I’m always learning new stuff and might be wrong about this.

However, if I’m correct and you want to use the slash anyways, you would have to either use a different tag name altogether and then set a different page title for that tag name, or you would have to drop the slash and go with a . or _ or -.

Using the slash is a well-known trick with Hugo to breakdown taxonomy into multiple layers. It works quite nicely, except for this overcounting/duplication.