Hugo 0.123.0 breaks some usages of the relref shortcode

After having upgraded to 0.123.0 and now 0.123.1 and some relref short codes don’t work anymore.

Specifically the following seem to break:

  • {{< ref path="/posts/" outputFormat="rss" >}} (but {{< ref path="/" outputFormat="rss" >}} works)
  • Relative paths to parents also don’t work anymore: {{< relref "../2024-01-15 Navigating the tech maze" >}} (there is an index.md file in that folder).

Might be related:

Here’s a minimal example that shows the problem:

As a temporary fix it works to append a /index.md at the end, even if there is no file there.

One of the intentional breaking changes in v0.123.0 is the introduction and usage of a logical path.

There’s a detailed explanation of how this change affects relative paths here:
https://discourse.gohugo.io/t/did-relref-semantics-change/48306/8

I recommend reading more about logical paths here:
https://gohugo.io/methods/page/path/#finding-pages

Specifically, the difference between a file tree and a logical tree:
https://gohugo.io/methods/page/path/#logical-tree

I’ll have a look at your {{< ref path="/posts/" outputFormat="rss" >}} issue later today, which you’ve also posted here:
https://github.com/gohugoio/hugo/issues/12096#issuecomment-1956558338

Looking at the test repository you provided…

  • In content/posts/post-3/index.md change “…/post-2/” to “post-2”. This is the logical path as I described in my previous comment.
  • The problem with {{< relref path="/posts/" outputFormat="rss" >}} in content/posts/post-2/index.md will be addressed with:
    https://github.com/gohugoio/hugo/pull/12098

Thank you very much, that was super quick.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.