Getting Started with Saaru

Let's build our first site with Saaru!

documentation saaru


Prerequisites

  1. Have Rust installed!
  2. Clone this repository

Let's Build our first site with Saaru!

This tutorial aims to be as self-contained as possible, so you'll find file dumps that you can copy-paste into specific locations. Ideally, all you'll need is the saaru binary to follow along, and nothing else!

Folder Structure

Saaru is slightly opinionated about how you structure your source.

Use these commands to generate the necessary folder structure -

$ mkdir -p my_new_website/{src,static,templates}
$ touch my_new_website/{src/hello_world.md,templates/{base,tags,tags_page}.jinja,.saaru.json}
my_new_website
  |- .saaru.json
  |- src/
  |- |- hello_world.md
  |- templates/
  |- |- base.jinja
  |- |- tags.jinja
  |- |- tags_page.jinja
  |- static/

Files

We'll walk through each file and its use in the static site generator.

Next Steps

Once you're done doing this, head over to the usage section of the site to render your website - but if you don't want to, just do the following -

  1. Navigate to the cloned repository
  2. Run the following -
$ cargo run --release -- --base-path <path to my_new_website>
  1. Your website should now be in <path to my_new_website>/build/.
$ tree build

build/
├── hello_world.html
└── tags
    ├── base.html
    ├── index.html
    ├── intro.html
    └── saaru.html

1 directory, 5 files
  1. You can use an application like serve to then start a web server, which will make your website accessible via the browser.
$ cd build/
$ serve
  1. Rejoice!