How to add pages to category pages

I have a website with tutorial for Windows, Linux, Android and Internet.

I have the following 4 category pages:

/t/windows.html
/t/linux.html
/t/android.html
/t/internet.html

How can I make Hugo automatically add pages to correct category pages?

Is there a way to add front matter to the articles (tutorial pages)?

Should I use Related Content feature of Hugo?

Or include something like categories: android in the front matter of the pages and then something on the category pages?

How exactly can I apply it to my website?

Hi,

Have a read about the Taxonomies feature: https://gohugo.io/content-management/taxonomies

Hugo by default already has a categories taxonomy, so you could just add the correct categories to the posts’ front matter: https://gohugo.io/content-management/taxonomies#add-taxonomies-to-content

Assuming you have the correct layouts in place, Hugo would then generate a page at yoursite.com/categories/ and yoursite.com/categories/windows/ etc.

Is there a way to change the /categories/ folder name to something like /t/ or /c/ ?

@mickel1982, you need to read through the docs. That is required to use Hugo. Your questions are answered in the docs. I suggest you refer to Requesting Help for further resources. But you need to understand how Hugo is configured first. :slight_smile:

You’re right. I found the solution. But I cannot find the way to change the /categories/ folder name to something like /t/ or /c/. Or am I missing something in the docs?

/content/t/windows/_index.html
/content/t/linux/_index.html
/content/t/android/_index.html
/content/t/internet/_index.html

/layouts/_default/taxonomy.html:

{{ partial "header.html" . }}
<h1>{{ .Title }}</h1>
<hr>
{{ range .Pages }}
<p><a href="{{ .Permalink }}">{{ .Title }}</a></p>
{{ end }}
<br>
{{ partial "footer.html" . }}

config.toml file:

[taxonomies]
  category = "t"

And the following in the front matter of the pages:

t: ["Windows"]
t: ["Linux"]
t: ["Android"]
t: ["Internet"]