Can't make cross-references work

Hey, does anyone know what I am doing wrong?

My two files only contain title, date, and draft, where draft is set to false.

But I can not link from to my two posts in the math folder.
I used the following markdown:
[here]({{< relref “personal/” >}})
[here]({{< relref “/personal/” >}})
[here]({{< relref “personal/learning-journey” >}})
[here]({{< relref “personal/” >}})
[here]({{< relref “/personal/” >}})
[here]({{< relref “personal” >}})
and a couple more…

I either get: REF_NOT_FOUND: Ref “personal/”: “C:\PersonalBlog\content\math\”: page not found.
Or a 404.

Could not post the picture here, therefore I uploaded it on imgur:

Have you tried {{<ref "/persona/math/" >}}? Or just {{<ref "" >}}?

Can you share your repo or a minimal example that can reproduce the problem (because I use relref in almost all my posts, and they have been working well.)

Is it possible that you haven’t yet created content/personal/


rename content/math/ to content/math/

1 Like

Yes, that did not change anything.

I made my repo temporarily public. You can check it out here:

Yes I made indeed a typo in the snippet I sent. I meant the file “learning-roadmap.” However, fixing the typo did not fix anything else.

Sadly, this did not help.

I don’t see a “personal” directory under content/:

But I see content/math/personal/ and content/math/personal/ So you intersected learning-roadmap and mathematical-journey into learning-journey :slight_smile: .

So try:

  • {{< relref "learning-roadmap" >}}
  • {{< relref "mathematical-journey" >}}

Both should work.

Okay wait, maybe I should explain what I want to achieve :slight_smile:

I have the math category, which should be divided into two sections “proofs”, and some meta stuff like motivation, learning roadmap etc. which is called “personal”

My idea was that if you click on math on my website you see something like this:

“If you are interested in following my journey you can look [here].”

“If you are interested in my collections of proofs you can click [here].”

However, using {{< relref "learning-roadmap" >}} in my math/ does not work. I still get:
REF_NOT_FOUND: Ref "learning-roadmap": "C:\PersonalBlog\content\math\": page not found

Adding .md to learning-roadmap does not work either.

This is your content structure

├── blog
│   └──
├── books
│   └──
├── math
│   ├──
│   ├── personal
│   │   ├──
│   │   ├──
│   │   └──
│   └── proofs
│       └──
└── myself

  1. rename content/math/ to content/math/

Your current structure, math is Leaf Bundle, any md content under Leaf bundle will be treated as Page Resources, means the content will not treated as Published Page.

  1. Inside content/math/, if you want to reference to content/math/personal/ this is how to reference it.
File-Relative path reference:
{{< relref "personal/" >}}

The solution that @pamubay suggested worked for me. You need to make math/ a section and not a page. makes something a leaf bundle (or a single page). So you cannot nest more pages like learning-roadmap, mathematical-journey and other sections (branch bundles) like proofs under that.

You need to make it a section or branch bundle instead i.e. name the file math/ (the underscore is critical here).

See Page Bundles | Hugo.

This works:

1 file changed, 2 insertions(+)
content/math/{ =>} | 2 ++

renamed    content/math/ -> content/math/
rename from content/math/
rename to content/math/
@@ -5,3 +5,5 @@ draft: false
 Follow my journey [here]({{< ref "" >}})
+These work too: [here]({{< relref "learning-roadmap" >}}), [here]({{< ref "learning-roadmap" >}})
1 Like

Okay. First of all, this works. Appreciate your help!

As you can see it looks a bit “meh”.

For example, I don’t want the “Read more” or “reading time there”. However, they are specified in the config.toml for the whole site. Is it possible to make a config.toml which is only used by this particular To be more precise by the math/

And would it also be possible to change the layout for ONLY this particular as well?

1 Like

Yes it works. However, the text: “Follow my journey…” is not displayed. It displays only in a typical blog structure the sections. But this might be a problem with the theme itself :thinking:

Yes, that’s theme-related, you need to modify the theme.

1 Like

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