I’d be the first to say that relref and ref probably don’t help you much, since they still require considerable typing. It’s probably just as easy to create regular Markdown links like so: [see guide for more](/guide/guide2/).
I unfortunately don’t know of a way to get quicker/shorter links in Hugo for quick note-taking.
I guess, my real question is, why does a link to “guide2” in guide1.md link to “guide1/guide2” ? Given my wiki experience, that’s weird to me, but it seems to make perfect sense to hugo people, and I would like to understand why.
I guess based on your descriptions that you organised your files like so:
If you use standard permalinks (meaning, without changing the permalink setting), then the link to guide2.md would become /guide/guide2/.
If you structure your content differently and don’t put guide2.md in the /guide/ subdirectory like this:
Then the links to your two pages become /guide1/ and /guide2/ and then there’s no need to link to /guide/guide2/ anymore.
Of course you can use different ways to structure links in Hugo (see the previous link about permalinks). You can also override URLs. That way you can still keep guide2.md in its /guide/ folder, but then it will render at the URL you specify.
Remember that you are not using a wiki system here.
What is happening is that you are telling the browser to link to the relative path: guide2. The browser interprets relative paths relative to the current page, which in this case is guide1 - thus creating a link to guide1/guide2. A link of /guide2 would link to https://example.com/guide2/, /example/guide2 would link to https://example.com/example/guide2/, etc. It’s how HTML normally works, which is why Hugo people aren’t surprised.
Use the ref and relref shortcodes for these links, and everything should work out.
That’s how I would expect it to work, but it doesn’t for me. Sorry for not being clear.
I do have a content/guide directory that contains guide1 and guide2 markdown files. Sorry for not being clear.
If I put a relative link into guide1 to just guide2 (as in my OP), then the FULL path of that link is /guide/guide1/guide2. It’s the guide1 part that hugo adds that confuses me (and makes the link a 404). If link to /guide/guide2, it works. Adding the current page in to the relative link is what I can’t figure out a good reason for (but I suspect there is).
My personal advice is to not use relative links in content; as it get aggregated around (copied, RSS, indexed, etc), not all systems are smart enough to fill in the full path. I use absolute URLs for everything.
Relative URLs are okay for other use cases, such as if the content is used offline or propagated to lots of different domains.
This is true, but as a little sidenote: if you set canonifyURLs in the configuration file to true, Hugo automatically turns relative URLs like /guides/intro/ into www.example.com/guides/intro/ based on the base URL setting.
That way you can still write relative URLs in the content (which is much easier in my opinion, and more ‘wiki style’) but still have the website render with absolute URLs.
See here for the configuration variables. (Not that you need to read that link Maiki but I mention it here for Manithree in case he’s/she’s wondering what I’m talking about.)