Files
sukr/docs/content/features/sections.md
Timothy DeHerrera 69cd81621f feat(docs): create sukr documentation site with fixes
Self-documenting docs site built with sukr itself (dogfooding):

Core changes:
- Rename package from nrd-sh to sukr
- Move personal site to sites/nrd.sh/
- Update AGENTS.md and README.md

Documentation site (docs/):
- Add site.toml with sukr.io base URL
- Create docs-specific templates with sidebar navigation
- Add dark theme CSS with syntax highlighting colors
- Document all features: templates, sections, syntax highlighting,
  mermaid diagrams, and LaTeX math rendering

Bug fixes:
- Render individual pages for all sections (not just blog type)
- Add #[source] error chaining for Tera template errors
- Print full error chain in main() for better debugging
2026-01-31 16:14:04 -07:00

72 lines
2.0 KiB
Markdown

---
title: Sections
description: Automatic section discovery and processing
weight: 2
---
# Sections
sukr automatically discovers sections from your content directory structure.
## What is a Section?
A section is any directory under `content/` that contains an `_index.md` file:
```text
content/
├── _index.md # Homepage (not a section)
├── about.md # Standalone page
├── blog/ # ← This is a section
│ ├── _index.md # Section index
│ └── my-post.md # Section content
└── projects/ # ← This is also a section
├── _index.md
└── project-a.md
```
## Section Discovery
sukr automatically:
1. Scans `content/` for directories with `_index.md`
2. Collects all `.md` files in that directory (excluding `_index.md`)
3. Renders the section index template with the items
4. Renders individual content pages (for blog-type sections)
## Section Types
The section type determines which template is used. It's resolved in order:
1. **Frontmatter override**: `section_type: blog` in `_index.md`
2. **Directory name**: `content/blog/` → type `blog`
### Built-in Section Types
| Type | Behavior |
| ---------- | ------------------------------------------------------ |
| `blog` | Sorts by date (newest first), renders individual posts |
| `projects` | Sorts by weight, card-style listing |
| _(other)_ | Sorts by weight, uses default template |
## Section Frontmatter
In `_index.md`:
```yaml
---
title: My Blog
description: Thoughts and tutorials
section_type: blog # Optional, defaults to directory name
weight: 1 # Nav order
---
```
## Adding a New Section
1. Create directory: `content/recipes/`
2. Create index: `content/recipes/_index.md`
3. Add content: `content/recipes/pasta.md`
4. Optionally create template: `templates/section/recipes.html`
That's it. sukr handles the rest.