# Hugo Taxonomies Guide ## Current Status Taxonomies (categories and tags) are **currently disabled** in this Hugo site to keep it minimal. ## What Are Taxonomies? Hugo taxonomies are classification systems for your content: - **Categories** - Broad groupings (e.g., "Technology", "Personal", "Projects") - **Tags** - Specific keywords (e.g., "golang", "web-development", "tutorial") They're useful for blogs and content-heavy sites where visitors need to filter and find related content. ## Why Are They Disabled? For a minimal personal website without a blog, taxonomies add unnecessary complexity: - Creates extra pages (`/categories/`, `/tags/`) that aren't used - Requires additional template files - Generates warning messages during builds ## How to Re-enable Taxonomies When you're ready to add a blog or need content categorization: ### Step 1: Enable Taxonomies in Configuration Edit `hugo.toml` and **remove** or **comment out** this line: ```toml # Remove this line: disableKinds = ['taxonomy', 'term'] ``` Or comment it out to keep for reference: ```toml # Taxonomies disabled for minimal site - uncomment to enable: # disableKinds = ['taxonomy', 'term'] ``` ### Step 2: Create Taxonomy Templates Create two template files in `layouts/_default/`: #### `layouts/_default/taxonomy.html` This template displays all content items for a single category or tag. ```html {{ define "main" }}

{{ .Title }}

{{ .Data.Plural }}: {{ len .Pages }} {{ if eq (len .Pages) 1 }}item{{ else }}items{{ end }}

{{ end }} ``` #### `layouts/_default/terms.html` This template lists all available categories or all available tags. ```html {{ define "main" }}

{{ .Title }}

Browse all {{ .Data.Plural | lower }}

{{ range .Pages }}
{{ .Title }}

{{ len .Pages }} {{ if eq (len .Pages) 1 }}post{{ else }}posts{{ end }}

{{ end }}
{{ end }} ``` ### Step 3: Add Taxonomies to Content Add categories and tags to your content front matter: ```markdown --- title: "My Blog Post" date: 2024-10-27 categories: - Technology - Web Development tags: - hugo - golang - static-sites --- Your content here... ``` ### Step 4: Optional - Configure Menu Links Add taxonomy pages to your navigation in `hugo.toml`: ```toml [menu] [[menu.main]] name = "Categories" url = "/categories/" weight = 10 [[menu.main]] name = "Tags" url = "/tags/" weight = 20 ``` ### Step 5: Optional - Customize Taxonomy Names If you want different taxonomy names (e.g., "Topics" instead of "Categories"): ```toml [taxonomies] topic = "topics" tag = "tags" ``` Then use in front matter: ```markdown --- topics: - Web Development tags: - hugo --- ``` ## Testing After Re-enabling After re-enabling and creating templates: ```bash # Build the site hugo # Start the server hugo server -D # Visit in browser: # http://localhost:1313/categories/ # http://localhost:1313/tags/ # http://localhost:1313/categories/technology/ # http://localhost:1313/tags/hugo/ ``` You should see: - No warnings in build output - Category and tag listing pages - Individual category/tag pages showing filtered content ## Custom Taxonomies Hugo supports custom taxonomies beyond categories and tags: ```toml [taxonomies] category = "categories" tag = "tags" series = "series" # For blog post series author = "authors" # For multi-author blogs project = "projects" # For portfolio sites ``` Use in content: ```markdown --- series: ["Getting Started with Hugo"] authors: ["Markus Graf"] projects: ["Personal Website"] --- ``` ## References - [Hugo Taxonomies Documentation](https://gohugo.io/content-management/taxonomies/) - [Hugo Template Lookup Order](https://gohugo.io/templates/lookup-order/) - Bootstrap Components used: Cards, List Groups (see [Bootstrap Docs](https://getbootstrap.com/docs/5.3/)) ## See Also - `IMPLEMENTATION_SUMMARY.md` - Overview of the Hugo site structure - `hugo.toml` - Main configuration file - `layouts/_default/` - Template directory