docs: document navigation, TOC, and template context

Add comprehensive documentation for recently implemented features:
- [nav] config section (nested, toc toggles)
- Complete frontmatter fields reference (10 fields)
- Hierarchical navigation behavior with ASCII diagram
- Template context: nested_nav, anchors array, page.toc
- Nav item structure including children for nested menus
This commit is contained in:
Timothy DeHerrera
2026-02-01 11:00:20 -07:00
parent 3d5682c59f
commit f38303b7e0
3 changed files with 82 additions and 14 deletions

View File

@@ -40,6 +40,25 @@ sukr -c sites/blog/site.toml
# Paths resolve relative to sites/blog/
```
## Navigation Configuration
Control how navigation menus are generated:
```toml
[nav]
nested = false # Show child pages under sections
toc = false # Enable table of contents globally
```
| Field | Default | Description |
| -------- | ------- | --------------------------------------------------- |
| `nested` | `false` | Display section children as nested sub-menus |
| `toc` | `false` | Show heading anchors in sidebar (table of contents) |
When `nested = true`, section pages appear as indented sub-items under their parent section. When `toc = true`, h2-h6 headings are extracted and displayed as anchor links in the sidebar.
Both settings can be overridden per-page via frontmatter.
## CLI Options
```bash
@@ -62,9 +81,26 @@ weight: 10 # Sort order (lower = first)
nav_label: Short Name # Override nav display
section_type: blog # Override section template
template: custom # Override page template
toc: true # Override global TOC setting
link_to: https://... # External link (for project cards)
---
```
### Frontmatter Fields
| Field | Type | Description |
| -------------- | ------- | ---------------------------------------------- |
| `title` | string | Page title (required) |
| `description` | string | Meta description |
| `date` | string | Publication date (YYYY-MM-DD) |
| `weight` | integer | Sort order (lower = first, default 50) |
| `nav_label` | string | Override navigation label (defaults to title) |
| `section_type` | string | Template dispatch (e.g., "blog", "projects") |
| `template` | string | Custom template path |
| `toc` | boolean | Enable/disable table of contents for this page |
| `link_to` | string | External URL (renders as link instead of page) |
| `tags` | list | Tags for categorization |
### Section Types
The `section_type` field determines which template is used for section indexes: