Expand description
Shokunin Static Site Generator (SSG)
A Content-First Open Source Static Site Generator (SSG) written in Rust.
Part of the Mini Functions family of Rust libraries.
Overview
Discover Shokunin: The high-performance, Rust-backed Static Site Generator (SSG) that puts content at the forefront of your web experience.
Features
Shokunin Static Site Generator (SSG) has several notable features, including but not limited to:
- Speed and Flexibility: Built in Rust, offering optimal performance.
- Built-in Supports:
- GitHub Flavoured Markdown (GFM) for intuitive content creation.
- Integrated support for Google Analytics and Bing Analytics.
- Automated sitemap generation, robots.txt, canonical name (CNAME) records, and custom 404 pages.
- Compatibility: Extensive support for various HTML themes and Premium templates.
- Advanced Features:
- Atom and RSS feeds for blog posts, offering greater discoverability.
- Minified HTML, CSS, and JavaScript files for better performance and SEO.
- Development Server: Comes with a Rust-based local development server for easier debugging and testing.
- Format Support: Comprehensive format support including Markdown, YAML, JSON, TOML, XML, etc.
Usage
Command Line Interface (CLI)
The CLI is straightforward. Below are examples to guide you:
# Create a new site named mysite
ssg --new=mysite --content=content --template=template --output=output --serve=public
or
# Alternative shorter command
ssg -n=mysite -c=content -t=template -o=output -s=public
Arguments Explained:
-n,--new: Name of the new website. (e.g.,--new=MyBlog)-c,--content: Directory containing website content. (e.g.,--content=./content)-t,--template: Directory containing website templates. (e.g.,--template=./templates)-o,--output: Directory where generated website files will be saved temporarily. (e.g.,--output=./build)-s,--serve: (Optional) Directory from which the website will be served. (e.g.,--serve=./public)
In your project
To incorporate Shokunin Static Site Generator (SSG) in your Rust project, add the following to your Cargo.toml:
[dependencies]
shokunin = "0.0.23"
And in your main.rs:
use ssg::compiler::compile;
use std::path::Path;
fn main() -> Result<(), Box<dyn std::error::Error>> {
// Uncomment and replace these paths with your directory paths
// let build_path = Path::new("your_build_directory");
// let site_path = Path::new("your_site_directory");
// let content_path = Path::new("your_content_directory");
// let template_path = Path::new("your_template_directory");
// compile(build_path, content_path, site_path, template_path)?;
Ok(())
}Contributing
We welcome contributions! Please see CONTRIBUTING.md for details on how to contribute.
License
This project is dual-licensed under the terms of both the MIT license and the Apache License (Version 2.0).
Modules
- The
compilermodule contains functions for the compilation process. - The
macrosmodule contains functions for generating macros. - The
modelsmodule contains the structs. - The
modulesmodule contains the application modules. - The
climodule contains functions for the command-line interface. - The
utilitiesmodule contains utility functions.
Macros
macro_check_directoryMacromacro_cleanup_directoriesMacromacro_create_directoriesMacro- Macros related to executing shell commands.
macro_generate_metatagsMacromacro_generate_rssMacromacro_generate_tags_from_fieldsMacromacro_generate_tags_from_listMacromacro_get_argsMacro- Custom logging macro for various log levels and formats.
macro_metadata_optionMacromacro_render_layoutMacromacro_serveMacromacro_set_rss_data_fieldsMacromacro_write_elementMacro
Functions
- Function:
run- Runs the static site generator command-line tool.