# Broken links using relref with absolute path

**URL:** <https://discourse.gohugo.io/t/broken-links-using-relref-with-absolute-path/40961>\
**Category:** support\
**Created:** [October 15, 2022, 11:19pm UTC](https://discourse.gohugo.io/t/broken-links-using-relref-with-absolute-path/40961 "2022-10-15T23:19:06Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![McShelby](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/mcshelby/32/15112_2.png) [@McShelby](https://discourse.gohugo.io/u/McShelby)\
**Post date:** [October 15, 2022, 11:19pm UTC](https://discourse.gohugo.io/t/broken-links-using-relref-with-absolute-path/40961/1 "2022-10-15T23:19:06Z")

</div>

Hi guys, not quite sure, if I am doing something wrong or if I’ve experienced a bug with `relref` and absolute links.

I am running `hugo server` on my page.

> hugo v0.104.2-84cbe724983b4b6153fd39aae0888cbb89a56cda windows/amd64 BuildDate=2022-09-29T10:31:09Z VendorInfo=gohugoio

My site’s repo is [https://github.com/McShelby/hugo-theme-relearn/](https://github.com/McShelby/hugo-theme-relearn/)

Significant settings in my `config.toml`

```toml
relativeURLs = false
uglyURLs = false

# only for this example to let hugo generate the page regardless of this error
refLinksErrorLevel = "warning" 

```

My page structure is basically this

```auto
content
├── cont
│ ├── _index.en.md
│ ├── icons.en.md

```

In `content/cont/_index.en.md` I’ve put the following links for testing purposes:

```markdown
[broken]({{% relref "/cont/icons/" %}})
[works]({{% relref "/cont/icons" %}})
[works]({{% relref "./icons/" %}})
[works]({{% relref "./icons" %}})

```

While the first link is broken and points to the home page, all the others are working and linking to the correct page. Is this expected behavior?

---

<div class="post-metadata">

**Author:** ![jmooring](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/jmooring/32/4214_2.png) [@jmooring](https://discourse.gohugo.io/u/jmooring)\
**Post date:** [October 16, 2022, 5:24pm UTC](https://discourse.gohugo.io/t/broken-links-using-relref-with-absolute-path/40961/2 "2022-10-16T17:24:48Z")

</div>

> [@McShelby](#):
>
> `relref "/cont/icons/"`

This is looking for a branch bundle (section)

```auto
content/
└── cont/
    └── icons/
        ├── foo.md # {{< relref "/cont/icons/foo" >}}
        └── _index.md # {{< relref "/cont/icons/" >}}

```

---

<div class="post-metadata">

**Author:** ![McShelby](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/mcshelby/32/15112_2.png) [@McShelby](https://discourse.gohugo.io/u/McShelby)\
**Post date:** [October 16, 2022, 5:45pm UTC](https://discourse.gohugo.io/t/broken-links-using-relref-with-absolute-path/40961/3 "2022-10-16T17:45:50Z")

</div>

But isn’t this also looking for a branch bundle?

```auto
relref "./icons/"

```

So why does this work but not the former?

---

<div class="post-metadata">

**Author:** ![jmooring](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/jmooring/32/4214_2.png) [@jmooring](https://discourse.gohugo.io/u/jmooring)\
**Post date:** [October 16, 2022, 6:27pm UTC](https://discourse.gohugo.io/t/broken-links-using-relref-with-absolute-path/40961/4 "2022-10-16T18:27:58Z")

</div>

> [@McShelby](#):
>
> So why does this work

I don’t think it should; I think it should error if the section page does not exist.

Having said that, the need for `ref` and `relref` shortcodes has largely, if not completely, been eliminated by the link render hook. So, while you could log an issue, it might not get any attention.

---

<div class="post-metadata">

**Author:** ![McShelby](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/mcshelby/32/15112_2.png) [@McShelby](https://discourse.gohugo.io/u/McShelby)\
**Post date:** [October 16, 2022, 6:45pm UTC](https://discourse.gohugo.io/t/broken-links-using-relref-with-absolute-path/40961/5 "2022-10-16T18:45:57Z")

</div>

The `render-image-hook` does only work with pure markdown links like

```markdown
[Page](/cont/link/)
[Page](./links/)

```

If `relref` is used and doesn’t find the link, the `render-image-hook` will receive `destination="/"` making it impossible to fix anything.

> the need for `ref` and `relref` shortcodes has largely, if not completely, been eliminated

Is this written somewhere in the docs? It’s sometimes really hard to find out by the docs which one is the right way.
