feat(wiki): page categories via frontmatter #668

Closed
opened 2026-06-21 06:32:43 +00:00 by jmiller · 0 comments
Owner

Summary

Add Wikipedia-style page categories using YAML frontmatter in wiki markdown files. Categories appear at the bottom of each page and link to auto-generated category index pages.

Design

Frontmatter Convention

---
categories: [architecture, api, reference]
tags: [golang, internal]
---
# Page Title
Content here...

Category Index Pages

  • Auto-generated pages at /:owner/:repo/wiki/category/:name listing all pages tagged with that category
  • No actual files needed — generated dynamically by scanning all wiki pages for frontmatter
  • Category names are case-insensitive, displayed with title case

UI

  • Category tags rendered at the bottom of each wiki page (below content, above footer)
  • Each tag is a clickable link to the category index page
  • Category index page shows: category name, page count, alphabetical list of pages with last-updated timestamps
  • Optional: "Categories" entry in the wiki sidebar tree (from existing WikiTree)

Implementation

Backend

  • Parse YAML frontmatter in renderViewPage() before passing content to markdown renderer — strip frontmatter from rendered output
  • New handler WikiCategory() that scans all .md files in the wiki git repo, parses their frontmatter, and collects pages matching the requested category
  • Add WikiCategories() handler for a master category list page

Files to Modify

File Change
routers/web/repo/wiki.go Frontmatter parsing, WikiCategory(), WikiCategories() handlers
templates/repo/wiki/view.tmpl Render category tags below content
templates/repo/wiki/category.tmpl New — category index page
Router registration Add routes for /wiki/category/:name

No Database Required

Categories live in the markdown files themselves (git-native). This means wikis remain fully clonable and portable — git clone gets you everything including metadata.

Wikipedia Parity

Categories are one of Wikipedia's core organizational features, enabling content discovery and taxonomy across thousands of pages.

## Summary Add Wikipedia-style page categories using YAML frontmatter in wiki markdown files. Categories appear at the bottom of each page and link to auto-generated category index pages. ## Design ### Frontmatter Convention ```markdown --- categories: [architecture, api, reference] tags: [golang, internal] --- # Page Title Content here... ``` ### Category Index Pages - Auto-generated pages at `/:owner/:repo/wiki/category/:name` listing all pages tagged with that category - No actual files needed — generated dynamically by scanning all wiki pages for frontmatter - Category names are case-insensitive, displayed with title case ### UI - Category tags rendered at the bottom of each wiki page (below content, above footer) - Each tag is a clickable link to the category index page - Category index page shows: category name, page count, alphabetical list of pages with last-updated timestamps - Optional: "Categories" entry in the wiki sidebar tree (from existing `WikiTree`) ### Implementation #### Backend - Parse YAML frontmatter in `renderViewPage()` before passing content to markdown renderer — strip frontmatter from rendered output - New handler `WikiCategory()` that scans all `.md` files in the wiki git repo, parses their frontmatter, and collects pages matching the requested category - Add `WikiCategories()` handler for a master category list page #### Files to Modify | File | Change | |------|--------| | `routers/web/repo/wiki.go` | Frontmatter parsing, `WikiCategory()`, `WikiCategories()` handlers | | `templates/repo/wiki/view.tmpl` | Render category tags below content | | `templates/repo/wiki/category.tmpl` | New — category index page | | Router registration | Add routes for `/wiki/category/:name` | ### No Database Required Categories live in the markdown files themselves (git-native). This means wikis remain fully clonable and portable — `git clone` gets you everything including metadata. ## Wikipedia Parity Categories are one of Wikipedia's core organizational features, enabling content discovery and taxonomy across thousands of pages.
jmiller added the feature: wiki label 2026-06-21 06:32:43 +00:00
Sign in to join this conversation.