Code Monkey home page Code Monkey logo

shokunin's Introduction

Shokunin Static Site Generator (SSG)

The fastest Rust-based Static Site Generator (SSG) for building professional websites and blogs.

Logo of the Shokunin Static Site Generator

Part of the Mini Functions family of Rust libraries.

Banner of the Shokunin Static Site Generator

Made With Rust Crates.io Lib.rs Docs.rs License Codecov

WebsiteDocumentationReport BugRequest FeatureContributing Guidelines

divider

Overview

Shokunin is a lightning-fast static site generator (SSG) that is optimised for Search Engine Optimisation (SEO) and fully aligned with Accessibility Standards.

The library extracts metadata and content to generate static HTML files from Markdown, YAML, JSON, and TOML. It also supports HTML themes and custom templates to help you create high quality websites with ease.

Features

Shokunin Static Site Generator (SSG) feature highlights include:

  • Blazing fast and flexible static site generator written in Rust
  • Built-in support for GitHub Flavoured Markdown (GFM)
  • Built-in support for Google Analytics and Bing Analytics
  • Experimental support for PDF generation
  • Compatible with various HTML themes and premium templates
  • Generates Atom and RSS feeds for your blog posts automatically
  • Generates minified HTML for optimal performance and SEO
  • Includes a built-in Rust development server for local testing
  • Supports multiple content formats:
    • Markdown
    • YAML
    • JSON
    • TOML
    • XML
  • Built-in generation for:
    • Sitemaps
    • robots.txt
    • Canonical name (CNAME) records
    • Custom 404 pages
  • Comprehensive documentation

Table of Contents

Getting Started

It takes just a few minutes to get up and running with Shokunin Static Site Generator (SSG).

Installation

To install Shokunin Static Site Generator (SSG), you need to have the Rust toolchain installed on your machine. You can install the Rust toolchain by following the instructions on the Rust website.

Once you have the Rust toolchain installed, you can install Shokunin Static Site Generator (SSG) using the following command:

cargo install ssg

For simplicity, we have given Shokunin Static Site Generator (SSG) a simple alias ssg which can stand for Shokunin Site Generator or Static Site Generator.

You can then run the help command to see the available options and commands:

ssg --help

Requirements

The minimum supported Rust toolchain version is currently Rust 1.71.1 or later (stable). It is recommended that you install the latest stable version of Rust.

Platform support

Shokunin Static Site Generator (SSG) is supported and tested on the following platforms and architectures as part of our CI/CD pipeline.

The GitHub Actions shows the platforms in which the Shokunin Static Site Generator (SSG) library tests are run.

Documentation

ℹ️ Info: Please check out our website for more information. You can find our documentation on docs.rs, lib.rs and crates.io.

Usage

Command Line Interface (CLI)

The Shokunin Static Site Generator (SSG) library runs in a Terminal window and can be used to easily generate a static website. To get started, run:

ssg  --new=docs --content=content --template=template --output=output --serve=public

or

ssg  -n=docs -c=content -t=template -o=output -s=public

This creates a new website in a directory called docs using the markdown content from the content directory and the HTML templates from the template directory. The static and compiled HTML files and artefacts are then generated in a docs folder.

Shokunin is ideal for hosting your site on GitHub Pages. Simply commit and push the docs folder to your main branch, and set the GitHub Pages publishing source to point to that folder.

During development, you can use the --serve or --s option to start a local development server to preview content changes.

With Shokunin's GFM and theme support, you can focus on writing markdown content while the SSG handles delivering a fast, SEO-friendly site.

Arguments

  • -n, --new: The name of the folder for your new website. (required)
  • -c, --content: The directory containing the website markdown content. (required)
  • -t, --template: The directory containing the HTML website templates. (required)
  • -o, --output: The directory where the generated website files will be saved temporarily. (required)
  • -s, --serve: Run the development server. (optional). The directory from which the website will be served. (optional)

In your project

To use the Shokunin Static Site Generator (SSG) library in your project, add the following to your Cargo.toml file:

[dependencies]
shokunin = "0.0.26"

Add the following to your main.rs file:

extern crate ssg;
use ssg::*;

then you can use the Shokunin Static Site Generator (SSG) functions in your application code.

Examples

To get started with Shokunin Static Site Generator (SSG), you can use the examples provided in the examples directory of the project.

To run the examples, clone the repository and run the following command in your terminal from the project root directory.

cargo run --example example

The command will generate a static website based on the configuration details in the examples directory.

use ssg::compiler::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("examples/example.com/build");
    let content_path = Path::new("examples/example.com/content");
    let site_path = Path::new("examples/example.com/public");
    let template_path = Path::new("examples/example.com/template");

    compile(build_path, content_path, site_path, template_path)?;

    Ok(())
}

The main() function in this code compiles a website from the content directory, using the template directory to generate the website files. The compiled website is saved in the build directory and served directly from the example.com directory.

Args

  • build_path: The path to the directory where the compiled website will be saved.
  • content_path: The path to the directory containing the website content.
  • site_path: The path to the directory where the generated website files will be served from.
  • template_path: The path to the directory containing the website templates.

Semantic Versioning Policy

For transparency into our release cycle and in striving to maintain backward compatibility, Shokunin Static Site Generator (SSG) follows semantic versioning.

License

The project is licensed under the terms of both the MIT license and the Apache License (Version 2.0).

Contribution

We welcome all people who want to contribute. Please see the contributing instructions for more information.

Contributions in any form (issues, pull requests, etc.) to this project must adhere to the Rust's Code of Conduct.

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Acknowledgements

A big thank you to all the awesome contributors of Shokunin for their help and support.

A special thank you goes to the Rust Reddit community for providing a lot of useful suggestions on how to improve this project.

shokunin's People

Contributors

dependabot[bot] avatar fubinator avatar sebastienrousseau avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

fubinator

shokunin's Issues

[Enhancement]: Refactoring lib.rs

🧪 Refactoring lib.rs

  • Decoupling into functions and files
  • Enhancing readability
  • Organising file in a logical and simpler structure
  • Increasing unit tests and code coverage

[Enhancement]: Create the website for shokunin

🧪 Create the website for shokunin

  • Ideally using shokunin to generate it 😄
  • The website should be committed to a gh-pages branch
  • Key requirements semantic HTML, Scalable Text, under 6kb, Minimal Animations and Visual Effects, W3C and WCAG 2.1
  • Ready for localization
  • Etc.

Open for ideas!

[Bug]: Missing template folder

❌ Current release v0.0.6 is missing the template directory available when running outside:

ssg --new=my-site --content=content --output=output

Propose resolution

  • Add ability to download a template when running the command line. This will allow users to host their own template files and or use community ones
  • Add the template as a new argument
ssg --new=my-site --template=template --content=content --output=output

[Bug]: Missing examples

❌ Missing examples both in the documentation and code base

  • Adding meaningful examples in code base
  • Adding meaningful examples in documentation
  • Documenting both on the README and code the examples

[Bug]: Bad value navigation for attribute role on element ul.

❌ Bad value navigation for attribute role on element ul.

Error: Bad value navigation for attribute role on element ul.

From line 128, column 21; to line 128, column 80

The error message is indicating that the value "navigation" used for the role attribute on the ul element is invalid.

To resolve the error, you can update the role attribute to a valid value based on the intended purpose of the ul element. For example:

<ul class="navbar-nav ms-auto mb-2 mb-lg-0" role="list">

Code blocks syntax high-light

It seems the code blocks are not supported in md files.
Is it possible to add this feature?

Such as

```ruby
require 'redcarpet'
markdown = Redcarpet.new("Hello World!")
puts markdown.to_html

Features comparison with other SSGs ?

Hello @sebastienrousseau,

I was looking an SSG for a new project, and just stepped onto you project, and wonder how your lib compete with zola for example ?

Why did you start it in the first place ? What was your complain about the existing tools and thus what do you expect to do fundamentally better/easier/different ?

Templates

Hello,
Could you give us a pre-defined or compatible templates list?

Documentation on usage outside of templates?

I was wondering if there was any documentation on how to actually use this outside of the code itself and the templates. I thought I'd try to take a look at making a blog out of this, but I haven't found any documents as to how to actually use this.

I can probably piece it together if there is no documentation already or documentation planned in the short term, but if there was I'd figure I'd would wait for it.

Pass the content of the "new" argument to compiler

Currently, the application name (provided by the cli's new flag) is not passed to the compile function. Instead, the site name is read with let mut site_name = match env::args().nth(1). This leads to some awkward string manipulations to get the site's name:

shokunin/src/lib.rs

Lines 232 to 237 in dc6817b

if site_name.starts_with("--new=") {
site_name = site_name[6..].to_owned();
site_name = site_name.replace(' ', "_");
} else {
site_name = "Shokunin".to_owned();
}

I think passing the site's name directly from the clap matches would be better. This also makes sure, that the user can use the cli without using =.

For example:
cargo run -- --new MY_SITE -c content/ -o dist

Broken Links in README

Hi, just stumbled across this project and found it interesting. I noticed that the links for Bug Report, Feature Request and Contributing Guidelines are broken in the README file.

I could fix that for you if you'd take a PR for that.

BTW: I'd like to contribute more stuff, but I'm not sure what. So if you have stuff open, feel free to create some issues and I would take a look at it

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.