adityatelange / hugo-PaperMod

A fast, clean, responsive Hugo theme.
https://adityatelange.github.io/hugo-PaperMod/
MIT License
9.72k stars 2.62k forks source link

Categories Section for Posts #1500

Closed woadey closed 5 months ago

woadey commented 5 months ago

My recent PR got closed (#1490), but I think it's still a valuable addition. Not to mention, it's optional...so if you don't want it you don't have to have it.Here are the details from the PR:

What does this PR change? What problem does it solve? Creates a new tab for "categories". This allows users to have groupings of posts (sort of like a folder) that can be navigated, rather than having to go through the "posts" tab or the "tags" tab.

Users simply create a folder called "categories" under "content". The _index.md file within the "categories" folder will be used to configure that page.

For creating each category page, just create folders (and their _index.md files) within the "categories" folder like so:

content
└── categories
│  └────  foo/ 
│  │  └────  _index.md  
│  └────  bar/ 
│  │  └────  _index.md  
│  └────  foobar/ 
│  │  └────  _index.md  
│  └────  _index.md 

Posts can be assigned to categories just as they would be for tags or keywords:

---
title: 'Example Post'
categories: ["PRs"]
tags: ["new thing"]
keywords: []
---