# Can't make cross-references work

**URL:** <https://discourse.gohugo.io/t/cant-make-cross-references-work/37395>\
**Category:** support\
**Created:** [February 28, 2022, 12:51am UTC](https://discourse.gohugo.io/t/cant-make-cross-references-work/37395 "2022-02-28T00:51:00Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![Anony](https://avatars.discourse-cdn.com/v4/letter/a/ce7236/32.png) [@Anony](https://discourse.gohugo.io/u/Anony)\
**Post date:** [February 28, 2022, 12:51am UTC](https://discourse.gohugo.io/t/cant-make-cross-references-work/37395/1 "2022-02-28T00:51:00Z")

</div>

Hey, does anyone know what I am doing wrong?

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

But I can not link from index.md to my two posts in the math folder.  
I used the following markdown:  
[here]({{\< relref “personal/learning-journey.md” \>}})  
[here]({{\< relref “/personal/learning-journey.md” \>}})  
[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/learning-journey.md”: “C:\PersonalBlog\content\math\index.md:7:26”: page not found.  
Or a 404.

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

[[Album] imgur.com ![](https://i.imgur.com/C2WDnw4.jpeg?fb "imgur.com") ](https://imgur.com/a/ElRFy4G)

---

<div class="post-metadata">

**Author:** ![funkydan2](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/funkydan2/32/5636_2.png) [@funkydan2](https://discourse.gohugo.io/u/funkydan2)\
**Post date:** [February 28, 2022, 1:54am UTC](https://discourse.gohugo.io/t/cant-make-cross-references-work/37395/2 "2022-02-28T01:54:25Z")

</div>

Have you tried `{{<ref "/persona/math/learning-journey.md" >}}`? Or just `{{<ref "learning-journey.md" >}}`?

---

<div class="post-metadata">

**Author:** ![kaushalmodi](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/kaushalmodi/32/2567_2.png) [@kaushalmodi](https://discourse.gohugo.io/u/kaushalmodi)\
**Post date:** [February 28, 2022, 2:24am UTC](https://discourse.gohugo.io/t/cant-make-cross-references-work/37395/3 "2022-02-28T02:24:12Z")

</div>

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/learning-journey.md`?

---

<div class="post-metadata">

**Author:** ![pamubay](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/pamubay/32/17838_2.png) [@pamubay](https://discourse.gohugo.io/u/pamubay)\
**Post date:** [February 28, 2022, 3:07am UTC](https://discourse.gohugo.io/t/cant-make-cross-references-work/37395/4 "2022-02-28T03:07:13Z")

</div>

@Anony

rename `content/math/index.md` to `content/math/_index.md`

---

<div class="post-metadata">

**Author:** ![Anony](https://avatars.discourse-cdn.com/v4/letter/a/ce7236/32.png) [@Anony](https://discourse.gohugo.io/u/Anony)\
**Post date:** [February 28, 2022, 9:52am UTC](https://discourse.gohugo.io/t/cant-make-cross-references-work/37395/5 "2022-02-28T09:52:17Z")

</div>

Yes, that did not change anything.

---

<div class="post-metadata">

**Author:** ![Anony](https://avatars.discourse-cdn.com/v4/letter/a/ce7236/32.png) [@Anony](https://discourse.gohugo.io/u/Anony)\
**Post date:** [February 28, 2022, 9:53am UTC](https://discourse.gohugo.io/t/cant-make-cross-references-work/37395/6 "2022-02-28T09:53:32Z")

</div>

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

> **[GitHub - m1guelperez/PersonalBlog: Sourcecode for personal blog.](https://github.com/m1guelperez/PersonalBlog)**
>
> Sourcecode for personal blog. Contribute to m1guelperez/PersonalBlog development by creating an account on GitHub.

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.

---

<div class="post-metadata">

**Author:** ![Anony](https://avatars.discourse-cdn.com/v4/letter/a/ce7236/32.png) [@Anony](https://discourse.gohugo.io/u/Anony)\
**Post date:** [February 28, 2022, 9:53am UTC](https://discourse.gohugo.io/t/cant-make-cross-references-work/37395/7 "2022-02-28T09:53:52Z")

</div>

Sadly, this did not help.

---

<div class="post-metadata">

**Author:** ![kaushalmodi](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/kaushalmodi/32/2567_2.png) [@kaushalmodi](https://discourse.gohugo.io/u/kaushalmodi)\
**Post date:** [February 28, 2022, 10:14am UTC](https://discourse.gohugo.io/t/cant-make-cross-references-work/37395/8 "2022-02-28T10:14:12Z")

</div>

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

 ![image](https://canada1.discourse-cdn.com/flex036/uploads/gohugo/original/3X/3/0/30b3f6a5b8d3416d27e9ac54350e15e2f5467ecd.png)

But I see [`content/math/personal/mathematical-journey.md`](https://github.com/m1guelperez/PersonalBlog/blob/master/content/math/personal/mathematical-journey.md) and [`content/math/personal/learning-roadmap.md`](https://github.com/m1guelperez/PersonalBlog/blob/master/content/math/personal/learning-roadmap.md). So you intersected learning-roadmap and mathematical-journey into learning-journey 🙂 .

So try:

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

Both should work.

---

<div class="post-metadata">

**Author:** ![Anony](https://avatars.discourse-cdn.com/v4/letter/a/ce7236/32.png) [@Anony](https://discourse.gohugo.io/u/Anony)\
**Post date:** [February 28, 2022, 10:31am UTC](https://discourse.gohugo.io/t/cant-make-cross-references-work/37395/9 "2022-02-28T10:31:05Z")

</div>

Okay wait, maybe I should explain what I want to achieve 🙂

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/index.md` does not work. I still get:  
`REF_NOT_FOUND: Ref "learning-roadmap": "C:\PersonalBlog\content\math\index.md:7:67": page not found`

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

---

<div class="post-metadata">

**Author:** ![pamubay](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/pamubay/32/17838_2.png) [@pamubay](https://discourse.gohugo.io/u/pamubay)\
**Post date:** [February 28, 2022, 10:40am UTC](https://discourse.gohugo.io/t/cant-make-cross-references-work/37395/10 "2022-02-28T10:40:37Z")

</div>

This is your content structure

```auto
content/
├── blog
│ └── rust-contribution.md
├── books
│ └── readings.md
├── math
│ ├── index.md
│ ├── personal
│ │ ├── _index.md
│ │ ├── learning-roadmap.md
│ │ └── mathematical-journey.md
│ └── proofs
│ └── _index.md
└── myself
    └── about.md

```

1. rename `content/math/index.md` to `content/math/_index.md`

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/_index.md`, if you want to reference to `content/math/personal/learning-roadmap.md` this is how to reference it.

```auto
File-Relative path reference:
{{< relref "personal/learning-roadmap.md" >}}

```

---

<div class="post-metadata">

**Author:** ![kaushalmodi](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/kaushalmodi/32/2567_2.png) [@kaushalmodi](https://discourse.gohugo.io/u/kaushalmodi)\
**Post date:** [February 28, 2022, 10:41am UTC](https://discourse.gohugo.io/t/cant-make-cross-references-work/37395/11 "2022-02-28T10:41:43Z")

</div>

The solution that @pamubay suggested worked for me. You need to make `math/` a section and not a page. `index.md` 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/_index.md` (the underscore is critical here).

See [Page Bundles | Hugo](https://gohugo.io/content-management/page-bundles/).

* * *

This works:

```diff
1 file changed, 2 insertions(+)
content/math/{index.md => _index.md} | 2 ++

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

```

---

<div class="post-metadata">

**Author:** ![Anony](https://avatars.discourse-cdn.com/v4/letter/a/ce7236/32.png) [@Anony](https://discourse.gohugo.io/u/Anony)\
**Post date:** [February 28, 2022, 10:47am UTC](https://discourse.gohugo.io/t/cant-make-cross-references-work/37395/12 "2022-02-28T10:47:41Z")

</div>

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

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

[[Album] imgur.com ![](https://i.imgur.com/iAxoCW4.jpeg?fb "imgur.com") ](https://imgur.com/a/EPVPcDN)

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 `_index.md`? To be more precise by the `math/_index.md`?

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

---

<div class="post-metadata">

**Author:** ![Anony](https://avatars.discourse-cdn.com/v4/letter/a/ce7236/32.png) [@Anony](https://discourse.gohugo.io/u/Anony)\
**Post date:** [February 28, 2022, 10:51am UTC](https://discourse.gohugo.io/t/cant-make-cross-references-work/37395/13 "2022-02-28T10:51:54Z")

</div>

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 🤔

---

<div class="post-metadata">

**Author:** ![pamubay](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/pamubay/32/17838_2.png) [@pamubay](https://discourse.gohugo.io/u/pamubay)\
**Post date:** [February 28, 2022, 11:12am UTC](https://discourse.gohugo.io/t/cant-make-cross-references-work/37395/14 "2022-02-28T11:12:55Z")

</div>

> [@Anony](#):
>
> 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 `_index.md` ? To be more precise by the `math/_index.md` ?
> 
> And would it also be possible to change the layout for ONLY this particular `_index.md` as well?

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

---

<div class="post-metadata">

**Author:** ![system](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/system/32/1_2.png) [@system](https://discourse.gohugo.io/u/system)\
**Post date:** [March 2, 2022, 11:13am UTC](https://discourse.gohugo.io/t/cant-make-cross-references-work/37395/15 "2022-03-02T11:13:49Z")

</div>

Closed on March 2, 2022, 11:13am UTC

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