The relURL function uses path.Join to assemble the return value.
Join joins any number of path elements into a single path, separating them with slashes. Empty elements are ignored. The result is Cleaned.
What does “Cleaned” mean? From the path.Clean documentation:
Clean returns the shortest path name equivalent to path by purely lexical processing. It applies the following rules iteratively until no further processing can be done:
1. Replace multiple slashes with a single slash.
2. Eliminate each . path name element (the current directory).
3. Eliminate each inner .. path name element (the parent directory)
along with the non-.. element that precedes it.
4. Eliminate .. elements that begin a rooted path:
that is, replace "/.." by "/" at the beginning of a path.
This was helpful:
Setting relativeURLs = true in config.toml has no effect when running hugo server. It only affects the output generated when you build the site with hugo.
That is not true, but I admit it that the relativeURLs = true feature is … confusing. But you are right in your above explanation. I think the important part is that.
relURL and .RelPermalink is conceptually the same
relativeURLs = true is something else, and works on the final output and should (if you’re diciplined enough) create URLs that works without a web server root (e.g. by clicking on the file on disk).
yields /feedback/. While this is correct for web sites (that by default serve an index.html when asked for a folder) it defeats the possibiliity to use the static files directly from disk (as suggested in https://gohugo.io/content-management/urls/#relative-urls).
Or is this the “It can’t be used for the homepage, section pages, etc.” exception?