Hugo

Ref relref error

I am writing the markdown file for a section (index.md) which is called “diy”. In it I would like to link to another document within the same section, which is called parts-required. Within the “parts-required” folder, I have a single file called index.md. I am using page bundles if that matters.

I have used every permutation I can think of but I still get the same error:
[en] REF_NOT_FOUND: Ref "tools-required/" I have tried the following for both rel and relref:

  1. [parts]({{< ref "diy/parts-required/index" >}})
  2. [parts]({{< ref "diy/parts-required/index.md" >}})
  3. [parts]({{< ref "/diy/parts-required/index.md" >}})
  4. [parts]({{< ref "/parts-required/index.md" >}})
  5. [parts]({{< ref "parts-required/index.md" >}})
  6. [parts]({{< ref "parts-required/index" >}})
  7. [parts]({{< ref "/parts-required/index" >}})
  8. [parts]({{< ref "/parts-required/" >}})

Obviously I am not sure how to use this feature.

I have not modified the URL structure in my toml file, just using the standard structure.

Could someone tell me how to use this feature or alternatively provide a different option for linking between documents if this will not work.

Share your code, or at least show us your full content structure, and we’ll be able to help you

I have the structure in my content folder:
content/
content/diy/index.md
content/diy/article1/index.md
content/diy/article2/index.md
content/diy/article3/index.md
content/diy/article4/index.md

I am trying to put a link in the markdown of content/diy/index.md so I can link to this page content/diy/article3/index.md

Try

{{ ref "diy/article3" }}

Thank you this worked. I did not think to remove the greater than and less than characters (left and right carrot).

What got me confused is the docs about Ref and Relref they only reference using the left and right carrot character. When using ref and relref in markdown, I didn’t realise I should omit these characters. It would be great if this information was in the docs.

Well… Just realized I omitted them by accident so I’m surprised it still worked when used in a markdown file.

So when you try it like this what happens?

[link text]({{< ref "diy/article3" >}})

Without the carrots, there is no error but the link is munted. With the carrots, I get the following error [en] REF_NOT_FOUND: Ref "diy/article3":

Hmm. Looking at your content structure again, I think you have an invalid branch bundle. Try changing:

content/diy/index.md

To:

content/diy/_index.md
1 Like

That fixed it, thank you very much @zwbetz

Just incase someone else finds this.

  1. Change the index.md file to _index.md
  2. make the references look like [link text]({{< ref "/diy/article3/index" >}}) or [link text]({{< ref "article3/index" >}}) or [link text]({{< ref "article3/" >}})

If I omit the index for this format - [link text]({{< ref "/diy/article3/index" >}}) - I get a page not found error

In the case of [link text]({{< ref "article3/" >}}) I get the warning below.

WARNING: make non-relative ref/relref page reference(s) in page "/diy/_index.md" absolute, e.g. {{< ref "/blog/my-post.md" >}}