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