Tag links do not work in 0.92

So, since I upgraded from 0.5x to 0.92 my links to tags that filter out posts do not work, ie:

http://localhost:1313/tags/tools/

Still shows all posts.

This is the code I use to generate the URL:

<div class="tags">
  <i name="hint" class="fas fa-tags"></i>
  {{ with .Params.tags }}
  {{ range . }}
  {{ $href := print (absURL "tags/") (urlize .) }}
  <a href="{{ $href }}">#{{ . }}</a><span class="space"></span>
  {{ end }}
  {{ end }}
</div>

The links are properly generated, but again, using them has no effect, all posts are displayed.

My config:

{
  "baseURL": "https://xx.xx/",
  "languageCode": "en-us",
  "title": "xx",
  "enableInlineShortcodes": true,
  "googleAnalytics": "UA-x-1",
  "summaryLength": 20,
  "paginate": 4,
  "permalinks": {
    "post": "/:slug/",
    "fixed": "/:slug/"
  },
  "params": {
    "author": "Gabriel",
    "dateFormat": "2006-01-02",
    "twitterURL": "xx",
    "twitterTXT": "@xx",
    "subTitle": "I'm Gabriel"
  },
  "menu": {
    "main": [
      {
        "name": "Home",
        "url": "/",
        "weight": 1
      },
      {
        "name": "About Me",
        "url": "/about-me",
        "weight": 2
      }
    ]
  }
}

Which template is being used to render your term pages?
What is the range statement within that template?

Hey, My own template.

Check in this part of the code I shared:

{ with .Params.tags }}
{{ range . }

Yeah, that doesn’t help. What would help is seeing your entire 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.

Here Joe: https://github.com/GAZ082/faketheme

You have one template for listing pages: layouts/_default/list.html

That template iterates through:

where .Site.RegularPages.ByDate.Reverse "Section" "post"`

So you are getting the same results regardless of whether you are viewing a section, taxonomy, or term page.

Create some new layouts:

layouts/
β”œβ”€β”€ _default/
    β”œβ”€β”€ baseof.html
    β”œβ”€β”€ list.html
    β”œβ”€β”€ single.html
    β”œβ”€β”€ taxonomy.html   <-- new
    └── terms.html      <-- new

And in the new ones, just iterate over .Pages

1 Like

Thanks Joe! Creating a Taxonomy fixed the issue (for reference, made just like a list.html and paginated through .Pages).

One last question, when are terms used?

A taxonomy template list the terms associated with a given taxonomy.
A terms template lists the pages associated with a particular term in a given taxonomy.

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