How can I edit the tags page of a specific contents page

Hello. I have my a Hugo setup with nested contents folder where my contents folder has 4 categories, one of which has a couple of subcategories.

Since each of these subcategories has its own design and posts, I want to be able to edit the tags page instead of having a default one that goes for all the categories. I tried to create a tags folder for one of the subcategories with a list.html file but that didn’t help.

If you haven’t already done so, please read this:
https://gohugo.io/templates/lookup-order/

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

See Requesting Help.

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.

Hello, thanks for the links!

I want the displayed posts to look differently if someone would click on a given tag in recommendations/recipes

I’ll look at this in more detail in a few minutes, but you might want to read this:
https://developer.mozilla.org/en-US/docs/Web/HTML/Element/center

Thanks a lot! yeah I am lazy hence why I was into using the forbidden center tag.

When I build your site…

ERROR render of “taxonomy” failed: “/home/jmooring/temp/mysite/layouts/tags/list.html:17:39”: execute of template failed: template: tags/list.html:17:39: executing “main” at <.File.BaseFileName>: error calling BaseFileName: runtime error: invalid memory address or nil pointer dereference
Total in 133 ms
Error: error building site: render: failed to render pages: render of “taxonomy” failed: “/home/jmooring/temp/mysite/layouts/tags/list.html:17:39”: execute of template failed: template: tags/list.html:17:39: executing “main” – File is nil; wrap it in if or with: {{ with .File }}{{ .BaseFileName }}{{ end }}

There are so many things wrong here I’m not even sure where to begin.

No:

content/blog/
├── Blog_post.png
├── _index.html
├── about.md
├── about.png
├── adnane.md
├── adnane.png
├── autobiography.md
└── blog_post.md

Yes (use page bundles):

content/blog/
├── about/
│   ├── cover.png
│   └── index.md
├── adnane/
│   ├── cover.png
│   └── index.md
├── blog_post/
│   ├── cover.png
│   └── index.md
├── _index.html
└── autobiography.md

No:

<div class="postpicture">
    <img src="/{{ .File.BaseFileName }}.png">
</div>

Yes (capture the bundled resource):

<div class="postpicture">
  {{ with .Resources.Get "cover.*" }}
    <img src="{{ .RelPermalink }}" width="{{ .Width }}" height="{{ .Height }}" alt="">
  {{ end }}
</div>

I suggest you get the basics working before worrying about the rest.

Thanks, I will try to adapt this to my workflow.

I am new to hugo though, everything that I could acomplish so far was just by googling things out. Also, are we on the same hugo version ? because I could build my site after cloning the repo and had no errors.

I’m using the latest version, as should you.

Hello again, yes we were few updates away from each other and your new code wouldn’t work on mine so I had to update. Thanks a lot! I will push the updates on my github later. How do I work on the tags page of recommendations/recipes ?

I would be happy to help with that once you push your updates to Github.

Hi Applethal, ensure you’re structuring your content correctly. Create a tags folder within the relevant subcategory’s folder, within this tags folder, place a list.html file for customization. If the default structure isn’t working, check your theme’s documentation or modify the theme to support your desired structure. Furthermore, test your changes to ensure the tags page displays as intended for the specific subcategory.