Skip to content

A Content-First Open Source Static Site Generator (SSG) written in Rust πŸ¦€

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT
Notifications You must be signed in to change notification settings

sebastienrousseau/shokunin

Shokunin logo

Shokunin Static Site Generator (SSG)

A content-first static site generator crafted in Rust, optimized for performance, accessibility, and search engine visibility.

Made With Love Crates.io lib.rs Docs.rs Codecov Build Status GitHub

β€’ Website β€’ Documentation β€’ Report Bug β€’ Request Feature β€’ Contributing Guidelines

Overview πŸš€

Shokunin is a high-performance static site generator (SSG) engineered in Rust that prioritises:

  • Content-first development approach
  • Lightning-fast site generation
  • WCAG 2.1 Level AA accessibility compliance
  • Advanced SEO optimization
  • Type-safe operations with comprehensive error handling

Key Features 🎯

Core Capabilities

  • ⚑ Exceptional Performance: Zero-cost abstractions through Rust
  • πŸ“± SEO Optimization: Built-in enhancements for search visibility
  • β™Ώ Accessibility: Automatic WCAG 2.1 Level AA compliance
  • πŸ› οΈ Multi-format Support: Handles Markdown, YAML, JSON, and TOML
  • πŸ”„ Feed Generation: Automatic Atom and RSS feed creation
  • πŸ“Š Analytics: Native Google and Bing Analytics integration
  • 🎨 Theming: Custom HTML themes and template support

Development Features

  • πŸ”§ CLI Tools: Comprehensive command-line interface
  • πŸš€ Dev Server: Built-in Rust server for local development
  • πŸ” Hot Reload: Automatic content updates during development
  • πŸ“ Type Safety: Guaranteed memory and thread safety
  • ⚑ Async Support: Full asynchronous operation capabilities

Getting Started πŸ“¦

Installation

Add to your Cargo.toml:

[dependencies]
ssg = "0.0.31"

Or install via Cargo:

cargo install ssg

Basic Usage

use staticdatagen::compiler::service::compile;
use std::{path::Path, error::Error};

fn main() -> Result<(), Box<dyn Error>> {
    // Define directory paths
    let build_dir = Path::new("./examples/build");          // Build directory
    let content_dir = Path::new("./examples/content");      // Content directory
    let public_dir = Path::new("./examples/public");        // Public directory
    let template_dir = Path::new("./examples/templates");   // Templates

    // Generate site
    compile(build_dir, content_dir, public_dir, template_dir)?;
    println!("✨ Site generated successfully!");
    Ok(())
}

CLI Usage

Create a new site:

# Full command syntax
ssg --content=content --template=templates --output=output --serve=public

# Short form
ssg -c=content -t=templates -o=output -s=public

# Using cargo run
cargo run --bin ssg -- -c="./examples/content" -t="./examples/templates" -o="./examples/output" -s="./examples/public"

CLI Options

Option Short Description Required
--content -c Content path Yes
--template -t Template path Yes
--output -o Output path Yes
--serve -s Server Public path Yes

Examples πŸ“š

Try our example implementations:

# Basic example
## Convert Markdown to static sites effortlessly, with templates, organized builds, and instant local hosting.
git clone https://github.com/sebastienrousseau/shokunin.git
cd shokunin
cargo run --example basic

# Quick start example
## Create, compile, and host a static site effortlessly with Shokunin: simple setup, error handling, and instant local server for previews.
cargo run --example quickstart

# Multilingual example
## Build multilingual static sites effortlessly: generate language-specific sites, create a language selector, and serve all from a single directory.
cargo run --example multilingual

Documentation πŸ“–

Contributing 🀝

We welcome contributions! Please see our Contributing Guidelines for details on:

  • Code of Conduct
  • Development Process
  • Pull Request Guidelines
  • Issue Reporting

License πŸ“„

This project is dual-licensed under:

at your option.

Acknowledgements πŸ™

Special thanks to all contributors who have helped build Shokunin.