[Solved] Confusion about ref / relref

Hi there,

my first Hugo site is coming along pretty nicely, but I seem to be quite confused about how to use ref / relref. This is part of what my content folder looks like:


In the _index.md file, I have the following link:

[algorithm developers]({{< ref "documentation/AlgorithmDevelopers.md" >}})

This, however, results in the following error message being thrown:

ERROR: 2017/02/23 00:06:20 template_funcs.go:1398: No page found with path or logical name "documentation/AlgorithmDevelopers.md".

As I understand the documentation, the argument to ref / relref can be a path to a markdown file relative to the content/ folder, which I believe is the case here. Am I missing something obvious?

I did think about whether markdown files combined with folders of the same name might be a problem. However, linking to a file that doesn’t have a sibling folder with the same base name gives me the same problem.

It seems that this works perfectly fine when I actually build the site. The problems only pertain to starting Hugo in the live server mode. In that mode, I also have problems with images that are placed in the same directory as the files that use them, which works fine in the export.

Turns out the problem seems to have been my baseURL, which looked something like this:


The folder messed up everything. I stumbled upon the canonifyURLs setting, which, set to true, seems to have solved everything.

1 Like

See also https://discuss.gohugo.io/t/canonifyurls-relativeurls-interaction/5448 for more on this topic.

1 Like