-
Notifications
You must be signed in to change notification settings - Fork 46
Home
Wok is a static website generator. It turns a pile of templates, content, and resources (like CSS and images) into a neat stack of plain HTML.
The idea is that you don't need a big server-side engine like PHP to generate every page every visit: you can generate them all ahead of time, and only regenerate things when something has changed. A good way this could be done would be with a post-commit hook on a git repository containing your content or layout.
I made wok because projects like Jekyll, Hyde, and Static were intriguing, but in the end didn't quite match what I wanted to do with my website. So I am writing my own.
- Processes content and templates, and renders them to a set of pure HTML.
- Provides tagging and a hierarchical category system for organizing pages.
- Handles all kinds of media and other site resources (like images, CSS, JavaScript files, etc.) automatically.
- Includes a simple development server.
- Supports pagination.
- Only regenerates pages that need it.
- Support for more markup languages (next up: ???)
To use wok, go to the directory where your site files are located, and run:
wok
If it returns without an error, you should have a shiny new output folder containing a clean set of HTML, and any site resources placed in the media
folder.
Wok pulls the pieces of your site from three locations: content
, templates
, and media
. (These directories can be changed in the config file.)
Content can be written in various markup languages (currently Markdown or reStructuredText), with a YAML header, separated by 3 hyphens alone on a line. For example:
title: Sample Post
author: Mike Cooper <[email protected]>
---
The content of the page.
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec
pellentesque, est non hendrerit mattis, arcu nibh venenatis sapien, quis
porta sem libero placerat magna. Suspendisse condimentum turpis fringilla
ligula porta vestibulum et ut sem. Cras hendrerit pulvinar metus at
imperdiet.
Content is rendered using Jinja2 templates. Wok looks for $templatename.html
in
the templates directory. Various variables relating to the site and the current page are provided to the template system. For example:
{% extends "base.html" %}
{% block content %}
<h1>{{ page.title }}</h1>
<div id='inner_content'>
{{ page.content }}
</div>
{% endblock %}
Any files in the media directory will be copied directly into the root of the output directory, regardless of how the media directory is organized. If a naming conflict occurs, only the last file to be copied will survive.
This feature is useful for handling any kind of media files (like images, CSS, JavaScript, etc.) and other site resources.
Settings can be changed in the file config
in your site's root directory. Possible configuration options can be found here.
More detailed information about wok.