How to change default template for /tags?

hugo version: hugo v0.101.0+extended

Here is the screenshot when accesing /tags:
/tags

I want to customize the layout.

What file should I create? and what is the source code for the default layout above?

I found this Taxonomy Templates | Hugo but nothing seems work, I think it’s not the right guide.

Thanks.

layouts/_default/taxonomy.html

See:
https://gohugo.io/templates/lookup-order/#examples-layout-lookup-for-taxonomy-pages

If you need additional assistance, please post a link to the public repository for your project.

See 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.

Hi, thank you for the reply.
What should I put there?

Here is my repo: GitHub - yusufmalikul/hugo-tags

The theme you are using is primitive at best.

About

Basic blog theme, “works for me”-quality. This is only here because someone wanted a copy; I don’t suggest that you use it :slight_smile:

Which leads to some duplication due to lack of a base/block architecture.

Also, your example site cannot be built because:

  • Your site configuration file cannot be found (it should be /config/_default/config.toml)
  • The content directory is misnamed (it should be /content not /yusuf_content)

layouts/_default/taxonomy.html

{{ partial "header.html" . }}
  <h1>{{ .Title }}</h1>
  {{ .Content }}
  {{ range .Pages }}
    <h2><a href="{{ .RelPermalink}}">{{ .Title }}</a></h2>
  {{ end }}
{{ partial "footer.html" . }}

Thank you! it works now. :smile:

The theme is very minimum but it can be build. :slight_smile:

I can’t find that source code in the docs. Is it written somewhere?

Start here:
https://gohugo.io/templates/lists#what-is-a-list-page-template

1 Like

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