TLDR: If I have multiple pages with the same title, how can I give a page a unique identifier that relref can use?
Here’s my scenario:
content/
install/
windows.md
mac.md
linux.md
troubleshooting/
windows.md
mac.md
linux.md
index.md
Say I want to use relref
inside index.md
:
Find out how to [install this application on Linux]({{< relref "linux" >}}).
This fails, because Hugo can find two pages with the title linux
. I could add the folder name to the relref, so something like {{< relref "install/linux" >}}
. This works. But if I want to change the directory structure in the future, then I’ll have to update all these links again… For example, if I changed the structure to:
content/
install/
cli/
windows.md
mac.md
linux.md
desktop/
windows.md
mac.md
linux.md
troubleshooting/
windows.md
mac.md
linux.md
index.md
Then I’d have to go into index.md
and change the relref link to {{< relref "install/cli/linux" >}}
. Obviously this is a simplifed example; in a production site I’d have to update lots of links.
How can I assign problem pages a unique identifier that relref can then use to create a link to each page? Or may I shouldn’t be using relref at all?