29 releases
0.0.30 | Nov 11, 2024 |
---|---|
0.0.29 | May 3, 2024 |
0.0.28 |
|
0.0.26 | Mar 2, 2024 |
0.0.9 | Mar 28, 2023 |
#42 in Template engine
133 downloads per month
125KB
2K
SLoC
Shokunin Static Site Generator (SSG)
A Content-First Open Source Static Site Generator (SSG) crafted in Rust.
• Website • Documentation • Report Bug • Request Feature • Contributing Guidelines
Overview
Shokunin is a lightning-fast static site generator (SSG) optimised for search engine visibility (SEO) and compliant with WCAG 2.1 Level AA accessibility standards.
Features
- ⚡ Blazing Fast Performance: Built in Rust for optimal speed and efficiency
- 📱 SEO Optimised: Built-in features for maximum search engine visibility
- 🛠️ Multiple Content Formats: Support for Markdown, YAML, JSON, and TOML
- 📊 Analytics Ready: Built-in support for Google Analytics and Bing Analytics
- 🔄 Automated Feeds: Automatic generation of Atom and RSS feeds
- 🎨 Flexible Theming: Compatible with custom HTML themes and templates
- 📱 Development Server: Built-in Rust server for local testing
Accessibility Compliance
Shokunin generates sites that meet Web Content Accessibility Guidelines (WCAG) standards:
- WCAG 2.1 Level AA compliance
- Accessible Rich Internet Applications (ARIA) support
- Semantic HTML structure
- Keyboard navigation support
- Screen reader compatibility
- Sufficient color contrast
- Responsive text scaling
- Alternative text for images
- Clear document structure
- Focus management
These accessibility features are automatically implemented in generated sites through:
- Semantic HTML templates
- ARIA landmark roles
- Proper heading hierarchy
- Skip navigation links
- Form input labels
- Keyboard focus indicators
- Color contrast validation
Installation
Add Shokunin to your Rust project:
# Cargo.toml
[dependencies]
shokunin = "0.0.30"
Basic implementation:
use staticdatagen::compiler::service::compile;
use std::path::Path;
fn main() -> Result<(), Box<dyn std::error::Error>> {
// Define the paths to the build, site, content and template directories.
let build_path = Path::new("build");
let content_path = Path::new("content");
let site_path = Path::new("public");
let template_path = Path::new("templates");
compile(build_path, content_path, site_path, template_path)?;
Ok(())
}
Usage
Create a new static site:
ssg --new=docs \
--content=content \
--template=templates \
--output=output \
--serve=public
Or use the short form:
ssg -n=docs -c=content -t=templates -o=output -s=public
Command-Line Options
Option | Short | Description | Required |
---|---|---|---|
--new |
-n |
New site directory name | Yes |
--content |
-c |
Content directory path | Yes |
--template |
-t |
Template directory path | Yes |
--output |
-o |
Output directory path | Yes |
--serve |
-s |
Development server directory | No |
Documentation
For full API documentation, please visit https://docs.rs/crate/ssg/.
Examples
To explore more examples, clone the repository and run the following command:
cargo run --example example_name
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
This project is licensed under either of
at your option.
Acknowledgements
Special thanks to all contributors who have helped build the ssg
library.
Dependencies
~41–76MB
~1.5M SLoC