Define your data models and instances in YAML and Markdown
Code your Jinja2/HTML templates and YAML views
statik and enjoy your shiny new
As is evident in the sheer number of static site generators available (see StaticGen), everyone's got an opinion as to how to build a static site generator, and what sorts of conventions to favour over configuration. Beyond the desire to make stuff, why build another one?
Most popular static site generators, like Jekyll or Pelican, are generally geared towards building blogs. Their taxonomies include terms such as Articles, Pages, Tags and Categories. This is great if you're building a blog or a small site with a few pages, but what if you want to do something a little more custom? Or what if you want to come up with your own taxonomy and way of organising your content? There are ways you can "force-fit" your taxonomy to those provided, such as clever usage of the Tags and Categories concepts, or you may need to go as far as building your own plugins for your generator.
Hugo, for example, is great for defining custom taxonomies, but it's still quite an involved process when you come from a background where you have experience in building relational databases and keep thinking to yourself: "If only I could just define my own relational data model here, I'd be able to ..."
That's where Statik comes in. For example, if you wanted a
Post model, you'd define it yourself:
# models/Post.yml title: String slug: String summary: Text date: DateTime content: Content
Is your curiosity piqued at all? If so, read on, and check out the documentation for more details.
Here's a bird's-eye comparison of some of the high-level features supported by Statik as compared to a handful of the other popular static site generators available today.
|Fully customisable data model|
|Custom ORM-style data queries|
|Build complex, non-blog static sites|
|Built-in hot reload server for testing|
|reStructured Text support|
|Custom plugin support|
# Set up your virtual environment using Python 3 > cd /path/to/your/project # For Python 2, do "virtualenv -p python2" instead of the following > virtualenv -p python3 . # Activate the virtual environment > source bin/activate # Install Statik from PyPI > pip install statik # Run Statik in your project's folder to build your static site into the # "public/" folder inside your project > statik
If you really wanted to, you could install Statik globally, but it's generally recommended (to avoid dependency conflicts) to install Python applications in their own virtual environments.
To create an empty Statik project in a folder, it's as easy as:
> statik --quickstart
Statik provides a built-in server to serve your built
static site's content, along with hot reloading to automatically
monitor your project for changes and reload your site in your browser.
By default it serves your content from
> statik --watch
Themes will be coming soon, so watch this space!