# .RelPermalink not working for tags

**URL:** https://discourse.gohugo.io/t/relpermalink-not-working-for-tags/29154
**Category:** support
**Tags:** taxonomy
**Created:** [October 31, 2020, 3:21pm UTC](https://discourse.gohugo.io/t/relpermalink-not-working-for-tags/29154 "2020-10-31T15:21:48Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![Hrishikesh](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/hrishikesh/32/19176_2.png) [@Hrishikesh](https://discourse.gohugo.io/u/Hrishikesh)
#### Post date: [October 31, 2020, 3:21pm UTC](https://discourse.gohugo.io/t/relpermalink-not-working-for-tags/29154/1 "2020-10-31T15:21:48Z")

</div>

After finishing my first ever Hugo website a few weeks back, I was trying to restart it from scratch. This was because I could rewrite the entire code which is clean, optimised and well-commented as opposed to the mess I created while learning the basics of Hugo. While doing so, I landed on a problem. I’m unable to use `.RelPermalink` to link to taxonomy pages. I’m displaying the posts as cards and below each card, I’m placing links to the tags it’s categorized it. I’m doing it something like (in my `layouts/index.html`):

```auto
{{ range where .Site.RegularPages "Section" "projects" }}

  <div> <!-- Card container -->

    <!-- rest of the code -->

    {{ range .Params.Tags }}
							
      <a href = "{{ $.RelPermalink }}">
        <p class = "tag tag-{{ . }}" uk-tooltip = "#{{ . }}">{{ . }}</p>
      </a>

    {{ end }}

  </div> <!-- /Card container -->

{{ end }}

```

I’m expecting the link to be something like `<example.com>/projects/tag/<tag name>/`. So, I have set-up the `config.toml` like this:

```auto
[permalinks]
  tags = "/projects/tag/:slug/"

```

However, when I run `hugo server` the links on the tags point to the home page. In the previous version of the website, I was using `printf` to get the link. That was something to get the job done. But, since I’m planning to keep the code clean, I don’t think using `printf` is a wise decision (or is it?).

Here’s my repo: [https://github.com/Hrishikesh-K/Portfolio/tree/v2](https://github.com/Hrishikesh-K/Portfolio/tree/v2)

Can someone please tell me if I can get `.RelPermalink` working here?

---

<div class="post-metadata">

### Author: ![alexandros](https://avatars.discourse-cdn.com/v4/letter/a/ecc23a/32.png) [@alexandros](https://discourse.gohugo.io/u/alexandros)
#### Post date: [October 31, 2020, 3:36pm UTC](https://discourse.gohugo.io/t/relpermalink-not-working-for-tags/29154/2 "2020-10-31T15:36:59Z")

</div>

That is not how one would list a taxonomy’s terms on a single page.

Please have a look at: [https://gohugo.io/templates/taxonomy-templates/#example-list-tags-in-a-single-page-template](https://gohugo.io/templates/taxonomy-templates/#example-list-tags-in-a-single-page-template)

In the above you are ranging through the `tags` parameter and `$.RelPermalink` points to the host root, because you are using the dollar sign.

[The dollar sign is used to access the global context](https://gohugo.io/templates/introduction/#2-use--to-access-the-global-context)

---

<div class="post-metadata">

### Author: ![Hrishikesh](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/hrishikesh/32/19176_2.png) [@Hrishikesh](https://discourse.gohugo.io/u/Hrishikesh)
#### Post date: [October 31, 2020, 3:53pm UTC](https://discourse.gohugo.io/t/relpermalink-not-working-for-tags/29154/3 "2020-10-31T15:53:20Z")

</div>

That was easy, but, stupid on my part. But, isn’t `index.html`, that is the website’s home page, a list page? I thought, since it accepts contents from `_index.md`, it’s a list page too.

---

<div class="post-metadata">

### Author: ![alexandros](https://avatars.discourse-cdn.com/v4/letter/a/ecc23a/32.png) [@alexandros](https://discourse.gohugo.io/u/alexandros)
#### Post date: [October 31, 2020, 4:13pm UTC](https://discourse.gohugo.io/t/relpermalink-not-working-for-tags/29154/4 "2020-10-31T16:13:43Z")

</div>

Yes. The homepage is by default ruled by a list template.

As per your code block above, you are rendering those terms within the context of each single page from a specific section i.e. `range where .Site.RegularPages "Section" "projects"`

---

<div class="post-metadata">

### Author: ![Hrishikesh](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/hrishikesh/32/19176_2.png) [@Hrishikesh](https://discourse.gohugo.io/u/Hrishikesh)
#### Post date: [October 31, 2020, 4:14pm UTC](https://discourse.gohugo.io/t/relpermalink-not-working-for-tags/29154/5 "2020-10-31T16:14:47Z")

</div>

That makes sense. Thanks a lot for the explanation.

---

<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: [November 2, 2020, 4:14pm UTC](https://discourse.gohugo.io/t/relpermalink-not-working-for-tags/29154/6 "2020-11-02T16:14:52Z")

</div>

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