# Internal link inside the footer.html file

**URL:** https://discourse.gohugo.io/t/internal-link-inside-the-footer-html-file/31932
**Category:** support
**Created:** [March 24, 2021, 12:34am UTC](https://discourse.gohugo.io/t/internal-link-inside-the-footer-html-file/31932 "2021-03-24T00:34:02Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![NovemberSnow](https://avatars.discourse-cdn.com/v4/letter/n/4bbf92/32.png) [@NovemberSnow](https://discourse.gohugo.io/u/NovemberSnow)
#### Post date: [March 24, 2021, 12:34am UTC](https://discourse.gohugo.io/t/internal-link-inside-the-footer-html-file/31932/1 "2021-03-24T00:34:02Z")

</div>

Hello,

I’m quite new to Hugo (after a couple of years on Jekyll).

I’d like to insert an internal link inside the `/layouts/partials/footer.html` file.  
This link would lead to a page named **colophon** located at `content/colophon/colophon.md`.  
All my attempts have been fruitless.  
Here they are:

The first line of code I inserted was:

`[colophon]{{< ref "/colophon/colophon.md" >}}`

It yielded an ERROR message in the terminal:

> parse failed: template: partials/footer.html:18: unexpected “\<” in command

Ditto with:

`[colophon]({{< relref “colophon.md” >}})`

I renamed the file `colophon.html` and successively tried:

```
 <a href="colophon.html"> colophon </a>
 <a href="/colophon/colophon.html"> colophon </a>
 <a href="content/colophon/colophon.html"> colophon </a>

```

The link (i.e. the word **colophon** ) would show in the footer, but clicking on it returned a `404 page not found`.

I feel I’m missing something very simple and obvious.

I looked up in the Hugo documentation, to no avail.

I’d be grateful if someone would tell me what I’m doing wrong.

Thanks!

---

<div class="post-metadata">

### Author: ![pointyfar](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/pointyfar/32/5797_2.png) [@pointyfar](https://discourse.gohugo.io/u/pointyfar)
#### Post date: [March 24, 2021, 1:34am UTC](https://discourse.gohugo.io/t/internal-link-inside-the-footer-html-file/31932/2 "2021-03-24T01:34:53Z")

</div>

Hi there,

> [@NovemberSnow](#):
>
> The first line of code I inserted was:
> 
> `[colophon]{{< ref "/colophon/colophon.md" >}}`

Do you mean you inserted this into the `layouts/partials/footer.html` file?

This line is in markdown syntax, and is meant to be used inside your markdown content file, not from a layout file.

> [@NovemberSnow](#):
>
> `<a href="colophon.html"> colophon </a>`

What does your config file look like?

By default, Hugo will render a page at `content/foo/bar/baz.md` to `yoursite.com/foo/bar/baz/index.html`, unless you have `uglyURL` configured.

* * *

There may be other things going on in addition to these issues, but you should try in your `layout/...` file, to add this:

```auto
<a href="/colophon/colophon/">Link to Colophon</a>

```

* * *

It is generally easier to help you if you had your site code somewhere we can have a look at. Have a read about [Requesting Help](https://discourse.gohugo.io/t/requesting-help/9132)

---

<div class="post-metadata">

### Author: ![NovemberSnow](https://avatars.discourse-cdn.com/v4/letter/n/4bbf92/32.png) [@NovemberSnow](https://discourse.gohugo.io/u/NovemberSnow)
#### Post date: [March 24, 2021, 2:20am UTC](https://discourse.gohugo.io/t/internal-link-inside-the-footer-html-file/31932/3 "2021-03-24T02:20:27Z")

</div>

HI pointyfar,

I followed your advice:

> There may be other things going on in addition to these issues, but you should try in your `layout/...` file, to add this:
> 
> ```auto
> <a href="/colophon/colophon/">Link to Colophon</a>
> 
> ```

and it worked!

Still, I don’t fully understand why `/colophon/colophon` did the job without the `.md` suffix. Any suggestion for some documentation about this would be most welcome!

Thanks again!

---

<div class="post-metadata">

### Author: ![pointyfar](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/pointyfar/32/5797_2.png) [@pointyfar](https://discourse.gohugo.io/u/pointyfar)
#### Post date: [March 24, 2021, 2:47am UTC](https://discourse.gohugo.io/t/internal-link-inside-the-footer-html-file/31932/4 "2021-03-24T02:47:09Z")

</div>

> [@NovemberSnow](#):
>
> Still, I don’t fully understand why `/colophon/colophon` did the job without the `.md` suffix.

That’s because you want to link to the _generated_ page, not the input file. The content file `colophon.md` does not exist in the published site, only the generated files do.

Hugo takes your content (i.e. `*.md` files) as input, and uses the layout files to figure out how to create the published HTML files.

Think of the content files as ingredients, the layout files as the recipe, and the published website as pancakes. After Hugo has assembled the ingredients in the way it is described in the recipe, all you will see is the final pancakes; you don’t see the flour independently of the milk.

Docs ref: [Content organization | Hugo](https://gohugo.io/content-management/organization/)

* * *

Note that there are many ways to accomplish the same thing in Hugo.

If, for example, you didn’t want to hard-code the URL to the page you want to link to (for instance if the URL is likely to change, but the content filename is not), the following should get you similar results:

```auto
<a href="{{ (site.GetPage "colophon/colophon.md").Permalink }}"> ... </a>
<a href="{{ relref . "/colophon/colophon.md" }}"> ... </a>

```

---

<div class="post-metadata">

### Author: ![NovemberSnow](https://avatars.discourse-cdn.com/v4/letter/n/4bbf92/32.png) [@NovemberSnow](https://discourse.gohugo.io/u/NovemberSnow)
#### Post date: [March 24, 2021, 3:03am UTC](https://discourse.gohugo.io/t/internal-link-inside-the-footer-html-file/31932/5 "2021-03-24T03:03:02Z")

</div>

Your analogy is so clear! Thanks!  
I think I will greatly benefit from re-reading the documentation.

And for sure I will test the alternate solutions you kindly mentioned:

```auto
<a href="{{ (site.GetPage "colophon/colophon.md").Permalink }}"> ... </a>
<a href="{{ relref . "/colophon/colophon.md" }}"> ... </a>

```

---

<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 26, 2021, 3:04am UTC](https://discourse.gohugo.io/t/internal-link-inside-the-footer-html-file/31932/6 "2021-03-26T03:04:02Z")

</div>

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