Overview
Thekosh new command creates a new Markdown file in the content/ directory with pre-filled frontmatter and a basic structure. The filename is automatically generated from the post title.
Usage
Arguments
The title of your new post. Used for both the frontmatter title and to generate a URL-safe filename slug.
Examples
Slug Generation
The command converts your title into a safe filename using these rules:- Lowercase: All characters converted to lowercase
- Spaces to Hyphens: Spaces replaced with
- - Remove Unsafe Characters: Characters like
<>:"/\|?*and control characters removed - Collapse Hyphens: Consecutive hyphens reduced to single hyphen
- Trim Hyphens: Leading/trailing hyphens removed
- Length Limit: Truncated to 100 characters if necessary
Slug Examples
| Title | Generated Slug |
|---|---|
Hello World | hello-world |
Go's Context: A Deep Dive | gos-context-a-deep-dive |
API/REST Patterns | apirest-patterns |
What??? No way! | what-no-way |
Multiple Spaces | multiple-spaces |
Generated Template
The command creates a file with this structure:content/your-slug.md
Frontmatter Fields
The post title from your command argument.
Auto-set to current date in
YYYY-MM-DD format.Short summary of the post content. Used for SEO meta description and social media previews.
Empty array. Add tags like
["go", "web-development"] for categorization.Set to
true to pin this post to the top of your blog.Set to
true to exclude from production builds. Use kosh build -drafts to include drafts.Automatic Build
After creating the file,kosh new automatically runs a build:
kosh serve.
Terminal Output
Error Handling
File Exists
If a file with the generated slug already exists, the command aborts:Empty Slug
If the title contains only special characters, the command aborts:Missing Title
If no title is provided:Workflow Tips
Quick Draft Workflow
Series/Category Workflow
File Permissions
Created files have permissions0644 (rw-rβrβ):
- Owner: read and write
- Group: read only
- Others: read only
Related Commands
kosh build- Build the site (automatically run afternew)kosh serve- Preview your new post locally