# How to make human url for tags?

**URL:** <https://discourse.gohugo.io/t/how-to-make-human-url-for-tags/22974>\
**Category:** support\
**Created:** [January 23, 2020, 10:48am UTC](https://discourse.gohugo.io/t/how-to-make-human-url-for-tags/22974 "2020-01-23T10:48:04Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![bublick](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/bublick/32/10428_2.png) [@bublick](https://discourse.gohugo.io/u/bublick)\
**Post date:** [January 23, 2020, 10:48am UTC](https://discourse.gohugo.io/t/how-to-make-human-url-for-tags/22974/1 "2020-01-23T10:48:04Z")

</div>

For example I have website in german. In my post front matter, I describe

```
---
title: "Aktuelle Tätigkeitsberichte"
date: 2020-01-23T12:17:05+02:00
draft: false
tags: ["Lösungen"]
author: "bublick"
---

```

Url of this post is ok, because I have config

```
[permalinks]
  posts = "/:year/:month/:filename/"

```

But url of tag is looks like  
[http://localhost:1313/tags/lösungen](http://localhost:1313/tags/l%C3%B6sungen)

How can I format this to  
[http://localhost:1313/tags/losungen](http://localhost:1313/tags/losungen)

Thank you!

---

<div class="post-metadata">

**Author:** ![ju52](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/ju52/32/6749_2.png) [@ju52](https://discourse.gohugo.io/u/ju52)\
**Post date:** [January 23, 2020, 12:01pm UTC](https://discourse.gohugo.io/t/how-to-make-human-url-for-tags/22974/2 "2020-01-23T12:01:07Z")

</div>

Compare with my sample Site

> **[gj52/HugoSample](https://github.com/gj52/HugoSample)**
>
> Hugo Sample. Contribute to gj52/HugoSample development by creating an account on GitHub.

It works for me.

Sorry für die kurze Antwort, bin gerade im Urlaub 🌴🌵☀

---

<div class="post-metadata">

**Author:** ![bublick](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/bublick/32/10428_2.png) [@bublick](https://discourse.gohugo.io/u/bublick)\
**Post date:** [January 23, 2020, 12:45pm UTC](https://discourse.gohugo.io/t/how-to-make-human-url-for-tags/22974/3 "2020-01-23T12:45:13Z")

</div>

@ju52, thank you. I try to run your sample theme.

---

<div class="post-metadata">

**Author:** ![davidsneighbour](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/davidsneighbour/32/24507_2.png) [@davidsneighbour](https://discourse.gohugo.io/u/davidsneighbour)\
**Post date:** [January 23, 2020, 1:00pm UTC](https://discourse.gohugo.io/t/how-to-make-human-url-for-tags/22974/4 "2020-01-23T13:00:14Z")

</div>

I created my german tags with ae, oe, ue and so on. Then created a file in `content/tags/loesungen.md` and then in that file you have the full power of frontmatter and can format the title as you want it.

---

<div class="post-metadata">

**Author:** ![bublick](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/bublick/32/10428_2.png) [@bublick](https://discourse.gohugo.io/u/bublick)\
**Post date:** [January 24, 2020, 9:21am UTC](https://discourse.gohugo.io/t/how-to-make-human-url-for-tags/22974/5 "2020-01-24T09:21:57Z")

</div>

@davidsneighbour, thank you, I’ve started this. I see that my tag page has a new title. But how I can print tag’s title from frontmatter, instead of beutifyied filename in my template? My template looks like

```
{{ with .Params.tags }}
  {{ $primaryTag := (index . 0) }}
    <section class="post-full-tags">
      <a href="{{ "/tags/" | relLangURL }}{{ $primaryTag | urlize }}">{{ $primaryTag }}</a>
    </section>
  {{ end }}

```

Thank you

---

<div class="post-metadata">

**Author:** ![davidsneighbour](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/davidsneighbour/32/24507_2.png) [@davidsneighbour](https://discourse.gohugo.io/u/davidsneighbour)\
**Post date:** [January 24, 2020, 9:55am UTC](https://discourse.gohugo.io/t/how-to-make-human-url-for-tags/22974/6 "2020-01-24T09:55:48Z")

</div>

Hmm, my template looks like yours:

> <https://github.com/davidsneighbour/dnb-hugo-garuda/blob/master/layouts/partials/content/meta-top.html#L10>

But I think I told you the wrong folder structure, sorry. I have an `_index.md` file in folders named per tag. I have this “system” with a custom taxonomy, so I am not sure if the following works: `content/tags/loesungen/_index.md` and in the file then:

```auto
---
title: Lösungen
slug: loesungen
---

```

Title is the one shown, slug is used for the link to the taxonomy page for this tag.

By the way, you need to add this structure only for tags that you want to change, not for each single tag.

---

<div class="post-metadata">

**Author:** ![bublick](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/bublick/32/10428_2.png) [@bublick](https://discourse.gohugo.io/u/bublick)\
**Post date:** [February 6, 2020, 7:51pm UTC](https://discourse.gohugo.io/t/how-to-make-human-url-for-tags/22974/7 "2020-02-06T19:51:17Z")

</div>

@davidsneighbour, thank you for your example. I found that folder structure don’t matter

```
/tags/tagname.md 
/tags/tagname/_index.md

```

in fact it works the same. I think that issue is related with the template which you (or me) are using. So, I decided to use simple range loop to resolve this.

```
<section class="post-full-tags">
    {{ range $index, $value := $.Params.tags }}
        {{ with $.Site.GetPage (printf "/tags/%s" $value) }}
            <a href="{{ .Permalink }}">{{ .Title }}</a>
        {{ end }}
    {{ end }}
</section>    

```

But to be honest, I need to add - this solution work only for single page. I can’t make this work on sideblocks in partials. I have no idea how to enable `$.Site.GetPage` in partial.

---

<div class="post-metadata">

**Author:** ![bublick](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/bublick/32/10428_2.png) [@bublick](https://discourse.gohugo.io/u/bublick)\
**Post date:** [February 6, 2020, 10:55pm UTC](https://discourse.gohugo.io/t/how-to-make-human-url-for-tags/22974/8 "2020-02-06T22:55:33Z")

</div>

I’ve resolved this.  
I’m connecting partial like

```
{{- partial "post-card.html" (dict "glob" $ "context" . "index" $index "home" $.IsHome) -}}

```

And as tag output:

```
{{ $glob := .glob }}
{{ range $value := .context.Params.tags }}
    {{ with $tag := $glob.Site.GetPage (printf "/tags/%s" . ) }}
        <div class="post-card-tag">{{ .Title }}</div>    
    {{ end }}
{{ end }}

```

I’m not sure if this is Hugo-way, so it will be nice to get a feedback from someone advanced in hugo.
