Internal links / hugo as wiki backend

Hi,

I am new to hugo and really like it so far. The first question I could not solve by myself: I have two content files so far: content/pages/page1.md and content/pages/page1.md. How can I link to each other without specifying the URL explicitly.

Background information: I want to abuse hugo to build a personal wiki, basically consisting of a bunch of markdown files which are rendered by hugo. One key feature of a wiki are low barrier internal links.

If anybody already knows of a project that uses hugo as a wiki backend, I am very interested.

1 Like

Have a look at the ref an relref shortcodes.

Thanks.
The examples at https://gohugo.io/extras/crossreferences/ go in the right direction.

Now I have the markdown code:

[some link text]({{< relref β€œpage2.md” >}})

which is converted to a html href as expected: <a href="/pages/page2/">some link text</a>

However, I would like to have a shorter syntax with as less boilerplate as possible, ideally like

[page2] converted to <a href="/pages/page2/">page2</a>

Is there such a simple syntax supported? If not, what would be the best way to implement it? (I plan to support some other syntax deviations from standard markdown anyway, such as todolists: https://github.com/blog/1825-task-lists-in-all-markdown-documents).

2 Likes

I’m also interested in this easier/shorter syntax for linking to internal pages, or crossrefs if you will. Basically I would like to be able to skip the use of shortcodes and just write [page2](page2) or [page3](/section/page3) or even [page4](tag/page4).

3 Likes

Does someone find how to use a specific template for relref links?

I want relref links to be blue for example. And other links in green. Is that possible without making a specific shortcode?