Prerequisites
- Go 1.23+ installed (download here)
- Git for theme installation
- A text editor (VS Code, Vim, etc.)
Installation & Setup
<Steps> <Step title=“Install Kosh”> Install the Kosh CLI viago install:
<CodeGroup>
macOS/Linux
Windows
$GOPATH/bin (Linux/macOS) or %USERPROFILE%\go\bin (Windows) is in your PATH.
</Note>
</Step>
<Step title=“Initialize Your Site”>
Create a new Kosh project with the default directory structure:
Blog Theme
Docs Theme
kosh.yaml to use your chosen theme:
kosh.yaml
kosh.yaml with your site details:
kosh.yaml
baseURL empty for local development—it auto-detects http://localhost:2604. Override with -baseurl flag in production.
</Note>
</Step>
<Step title=“Create Your First Post”>
Generate a new blog post with frontmatter:
content/my-first-post.md:
content/my-first-post.md
Frontmatter Reference
| Field | Type | Description |
|---|---|---|
title | string | Post title (required) |
description | string | Meta description for SEO |
date | string | Publication date (YYYY-MM-DD) |
tags | array | Tags for categorization |
draft | boolean | Exclude from builds if true |
pinned | boolean | Pin to top of homepage |
weight | number | Sort order (higher = first) |
image | string | Custom social card image |
| </Step> |
Include Drafts
Custom Port
Custom Host
Project Structure
After initialization and theme installation, your project looks like this:Common Workflows
<AccordionGroup> <Accordion title=“Writing Content” icon=“pen”>Create a New Post
Frontmatter Examples
Blog Post:Markdown Extensions
Kosh supports:- Admonitions:
:::info,:::warning,:::danger,:::note - Syntax Highlighting: Fenced code blocks with language tags
- LaTeX Math: Inline
$E = mc^2$and block$$...$$ - D2 Diagrams: Fenced blocks with
d2language tag - Tables: GitHub-flavored markdown tables
- Task Lists:
- [ ]and- [x]
LaTeX Example
D2 Diagram Example
Live Development
Start the dev server and edit files in real-time:content/- Markdown poststhemes/- Templates and theme assetsstatic/- Static filestemplates/- Custom templates (if not using theme)
Performance Tips
- Incremental builds: Only changed files rebuild (~100ms)
- Cache hits: ~95% on typical edits (BoltDB persistent cache)
- Parallel processing: 24 concurrent image workers by default
Development Flags
| Flag | Description |
|---|---|
--dev | Enable watch mode + live reload |
-drafts | Include draft: true posts |
--port 8080 | Change server port |
--host 0.0.0.0 | Bind to all interfaces |
| </Accordion> |
Build for Production
- Minified HTML, CSS, JS
- Optimized WebP images
sitemap.xmlfor SEOrss.xmlfeedsearch.bin(WASM search index)- Service worker (if PWA enabled)
- Social card images (Open Graph)
Build Output
Build Flags
Clean Build Artifacts
Cache Commands
Cache Operations
| Command | Description |
|---|---|
kosh cache stats | Show cache metrics |
kosh cache gc | Run garbage collection |
kosh cache verify | Check integrity |
kosh cache rebuild | Clear for full rebuild |
kosh cache clear | Delete all cache data |
kosh cache inspect <path> | Show entry details |
Garbage Collection
When to Clear Cache
- After upgrading Kosh versions
- When seeing stale content
- Before profiling build performance
- When cache size grows excessive
Cache Optimization
- Inline HTML: Posts < 32KB stored inline (faster lookups)
- Body hash tracking: Detects changes to post content only
- LRU cache: Hot PostMeta cached in-memory (5-minute TTL)
- Cross-platform: Normalized paths work on Windows/Linux/macOS </Accordion>
Deploy to GitHub Pages
<Steps> <Step title=“Create GitHub Repository”> Initialize a Git repository and push to GitHub:.github/workflows/deploy.yml:
.github/workflows/deploy.yml
- Go to repository Settings > Pages
- Under Source, select GitHub Actions
- Push to
mainbranch to trigger deployment
Custom Domain
To use a custom domain, add aCNAME file to static/:
static/CNAME
kosh.yaml:
Performance Tips
Build Performance
| Optimization | Impact | Description |
|---|---|---|
| Incremental builds | ~100ms | Only changed files rebuild |
| BoltDB cache | 95% hit rate | Persistent metadata cache |
| Parallel workers | 24 concurrent | Image conversion parallelized |
| Content hashing | BLAKE3 | Fast, cryptographically secure |
| Inline HTML | No disk I/O | Posts < 32KB stored inline |
Runtime Performance
- WASM Search: Client-side full-text search (no backend)
- Service Worker: Stale-while-revalidate caching
- Asset Fingerprinting:
layout-a3f2b1.cssenables infinite cache TTL - WebP Images: ~30% smaller than PNG/JPG
- Minified Assets: HTML/CSS/JS optimized for production
Benchmarking
Next Steps
Configuration Reference
Explore all
kosh.yaml options, theme settings, and feature flagsFeature Documentation
Learn about WASM search, incremental builds, and asset pipeline
Theme Development
Create custom themes with Go templates and detachable architecture
Advanced Features
Versioning, native rendering, and performance optimization
Troubleshooting
Common Issues
“kosh: command not found”- Ensure
$GOPATH/binis in your PATH - Run
go env GOPATHto find your Go path - Add
export PATH=$PATH:$(go env GOPATH)/binto.bashrcor.zshrc
- Verify theme exists at
themes/blog/orthemes/docs/ - Check
theme: "blog"matches directory name inkosh.yaml - Run
git clone https://github.com/Kush-Singh-26/kosh-theme-blog themes/blog
- Clear cache:
kosh clean --cache - Verify file watcher is running in dev mode
- Check frontmatter
draft: false
- Ensure Go 1.23+ in workflow:
go-version: '1.23' - Verify cache restoration step
- Check
-baseurlflag format
Getting Help
- GitHub Issues: Kush-Singh-26/kosh
- Documentation: README.md
- Examples: See
test-site/in the repository