# Adding list of tags to my homepage

**URL:** https://discourse.gohugo.io/t/adding-list-of-tags-to-my-homepage/41741
**Category:** support
**Created:** [December 3, 2022, 9:30pm UTC](https://discourse.gohugo.io/t/adding-list-of-tags-to-my-homepage/41741 "2022-12-03T21:30:51Z")
**Posts on this page:** 15
**Page:** 1

<div class="post-metadata">

### Author: ![Air](https://avatars.discourse-cdn.com/v4/letter/a/df705f/32.png) [@Air](https://discourse.gohugo.io/u/Air)
#### Post date: [December 3, 2022, 9:30pm UTC](https://discourse.gohugo.io/t/adding-list-of-tags-to-my-homepage/41741/1 "2022-12-03T21:30:51Z")

</div>

Hi, I have created hugo site based on this theme [GitHub - nodejh/hugo-theme-mini: A fast, minimalist and responsive hugo theme for bloggers.](https://github.com/nodejh/hugo-theme-mini)  
This theme has page with all generated tags ( [http://localhost:1313/tags/](http://localhost:1313/tags/) ) , however i want to place all my tags on my home page at the top before the articles, how can i do that?

---

<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: [December 3, 2022, 11:25pm UTC](https://discourse.gohugo.io/t/adding-list-of-tags-to-my-homepage/41741/2 "2022-12-03T23:25:23Z")

</div>

[https://gohugo.io/templates/taxonomy-templates/#example-list-all-site-tags](https://gohugo.io/templates/taxonomy-templates/#example-list-all-site-tags)

---

<div class="post-metadata">

### Author: ![Air](https://avatars.discourse-cdn.com/v4/letter/a/df705f/32.png) [@Air](https://discourse.gohugo.io/u/Air)
#### Post date: [December 5, 2022, 5:06pm UTC](https://discourse.gohugo.io/t/adding-list-of-tags-to-my-homepage/41741/3 "2022-12-05T17:06:03Z")

</div>

Thanks for the link, on that page I found that in order to generate tags list I need to use this code:

```auto
<ul>
    {{ range .Site.Taxonomies.tags }}
            <li><a href="{{ .Page.Permalink }}">{{ .Page.Title }}</a> {{ .Count }}</li>
    {{ end }}
</ul>

```

my website homepage html file looks like this:

```auto
{{ define "main" }} {{ partial "profile.html" . }}
{{ $pages := .Site.RegularPages }} {{ $paginator := .Paginate ($pages) }} {{ range $paginator.Pages }} {{ $title := .Title }} {{ $summary := .Summary }}

{{ $title }}
{{ i18n "publishDate" . }} 
{{ if ne .Site.Params.hiddenPostSummaryInHomePage true }}
{{ $summary | plainify | htmlUnescape }}
{{ end }} 
{{ end }} {{ if or ($paginator.HasPrev) ($paginator.HasNext) }}
{{ if $paginator.HasPrev }} â† {{ with .Site.Params.newerPosts }}{{ . }}{{ else }}{{ i18n "postsNewer" }}{{ end }} {{ end }} {{ if $paginator.HasNext }} {{ with .Site.Params.olderPosts }}{{ . }}{{ else }}{{ i18n "postsOlder" }}{{ end }} â†’ {{ end }} 
{{ end }} 
{{ end }} 

```

Can i just paste tag’s list code into my homepage html file ?

---

<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: [December 5, 2022, 5:18pm UTC](https://discourse.gohugo.io/t/adding-list-of-tags-to-my-homepage/41741/4 "2022-12-05T17:18:08Z")

</div>

Yes, provided that it appears **after** `{{ define "main" }}`.

And I assume your “homepage html file” is a template (in the layouts directory) and not content.

---

<div class="post-metadata">

### Author: ![Air](https://avatars.discourse-cdn.com/v4/letter/a/df705f/32.png) [@Air](https://discourse.gohugo.io/u/Air)
#### Post date: [December 5, 2022, 5:27pm UTC](https://discourse.gohugo.io/t/adding-list-of-tags-to-my-homepage/41741/5 "2022-12-05T17:27:09Z")

</div>

yes, my homepage html file is located in /layouts in theme’s folder

I have pasted code after `{{ define "main" }}` however now my homepage is a blank white page without content (there was content before i pasted the code)

```auto
{{ define "main" }} 
<ul>
    {{ range .Site.Taxonomies.tags }}
            <li><a href="{{ .Page.Permalink }}">{{ .Page.Title }}</a> {{ .Count }}</li>
    {{ end }}
</ul>
{{ partial "profile.html" . }}
{{ $pages := .Site.RegularPages }} {{ $paginator := .Paginate ($pages) }} {{ range $paginator.Pages }} {{ $title := .Title }} {{ $summary := .Summary }}
{{ $title }}
{{ i18n "publishDate" . }} 
{{ if ne .Site.Params.hiddenPostSummaryInHomePage true }}
{{ $summary | plainify | htmlUnescape }}
{{ end }} 
{{ end }} {{ if or ($paginator.HasPrev) ($paginator.HasNext) }}
{{ if $paginator.HasPrev }} â† {{ with .Site.Params.newerPosts }}{{ . }}{{ else }}{{ i18n "postsNewer" }}{{ end }} {{ end }} {{ if $paginator.HasNext }} {{ with .Site.Params.olderPosts }}{{ . }}{{ else }}{{ i18n "postsOlder" }}{{ end }} â†’ {{ end }} 
{{ end }} 
{{ end }} 

```

---

<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: [December 5, 2022, 5:43pm UTC](https://discourse.gohugo.io/t/adding-list-of-tags-to-my-homepage/41741/6 "2022-12-05T17:43:03Z")

</div>

Please show the directory structure of your layouts directory.

---

<div class="post-metadata">

### Author: ![Air](https://avatars.discourse-cdn.com/v4/letter/a/df705f/32.png) [@Air](https://discourse.gohugo.io/u/Air)
#### Post date: [December 5, 2022, 5:53pm UTC](https://discourse.gohugo.io/t/adding-list-of-tags-to-my-homepage/41741/7 "2022-12-05T17:53:55Z")

</div>

![Screenshot 2022-12-05 at 20.53.19](https://canada1.discourse-cdn.com/flex036/uploads/gohugo/original/3X/7/4/74f571ffd171723535862eba9e92978e580d9906.png)

---

<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: [December 5, 2022, 5:55pm UTC](https://discourse.gohugo.io/t/adding-list-of-tags-to-my-homepage/41741/8 "2022-12-05T17:55:01Z")

</div>

OK, we’re going need to look at your repository.

See [https://discourse.gohugo.io/t/requesting-help/9132](https://discourse.gohugo.io/t/requesting-help/9132).

> Let us see your code
> 
> Include a **link to the source code repository** of your project, because we really need the _context_ of seeing your templates and partials to be able to help you. It is trivial to do a quick `git clone` on your repo, then run `hugo server` in your project, to help you out. On the other hand, recreating your code from screenshots, or sort of guessing at it, is not.
> 
> If you can’t share your repository for whatever reason, consider creating a dummy repo that you _can_ share, which reproduces the problem you’re experiencing.

---

<div class="post-metadata">

### Author: ![Air](https://avatars.discourse-cdn.com/v4/letter/a/df705f/32.png) [@Air](https://discourse.gohugo.io/u/Air)
#### Post date: [December 5, 2022, 5:58pm UTC](https://discourse.gohugo.io/t/adding-list-of-tags-to-my-homepage/41741/9 "2022-12-05T17:58:17Z")

</div>

> **[GitHub - kir77777/mk](https://github.com/kir77777/mk)**
>
> Contribute to kir77777/mk development by creating an account on GitHub.

---

<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: [December 5, 2022, 6:03pm UTC](https://discourse.gohugo.io/t/adding-list-of-tags-to-my-homepage/41741/10 "2022-12-05T18:03:06Z")

</div>

Works fine for me like this:

 ![image](https://canada1.discourse-cdn.com/flex036/uploads/gohugo/original/3X/5/e/5e76fd464902a8bf721660f08dead0baeafb9d7c.png)

---

<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: [December 5, 2022, 6:10pm UTC](https://discourse.gohugo.io/t/adding-list-of-tags-to-my-homepage/41741/11 "2022-12-05T18:10:29Z")

</div>

By the way, instead of modifying files in the themes directory, copy the files you want to modify to the layouts directory in the root of your project. That way you can reinstall or update the theme without losing your work. Example:

```nohighlight
project/
└── layouts/
    ├── _default/
    ├── partials/
    └── shortcodes/

```

---

<div class="post-metadata">

### Author: ![Air](https://avatars.discourse-cdn.com/v4/letter/a/df705f/32.png) [@Air](https://discourse.gohugo.io/u/Air)
#### Post date: [December 5, 2022, 6:21pm UTC](https://discourse.gohugo.io/t/adding-list-of-tags-to-my-homepage/41741/12 "2022-12-05T18:21:46Z")

</div>

I found that the problem with white blank page is not caused by pasting this code, for some reasons if I make any change in index.html the homepage becomes blank white, even if I undo changes in index.html the screen is still white. Only when I replace index.html with old untouched version of index.html the content appears on the homepage again.

---

<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: [December 5, 2022, 6:22pm UTC](https://discourse.gohugo.io/t/adding-list-of-tags-to-my-homepage/41741/13 "2022-12-05T18:22:34Z")

</div>

I obviously didn’t have that problem. Not sure what you’re doing wrong.

---

<div class="post-metadata">

### Author: ![Air](https://avatars.discourse-cdn.com/v4/letter/a/df705f/32.png) [@Air](https://discourse.gohugo.io/u/Air)
#### Post date: [December 5, 2022, 6:35pm UTC](https://discourse.gohugo.io/t/adding-list-of-tags-to-my-homepage/41741/14 "2022-12-05T18:35:31Z")

</div>

I found that problem with blank page was caused by using mac text editor instead of any other editor with html support, now everything is working including tags on the homepage, thanks for the help!!!

---

<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: [December 7, 2022, 6:35pm UTC](https://discourse.gohugo.io/t/adding-list-of-tags-to-my-homepage/41741/15 "2022-12-07T18:35:35Z")

</div>

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