Skip to content
This repository has been archived by the owner on Jan 25, 2019. It is now read-only.
mythmon edited this page Jun 15, 2011 · 30 revisions

wok

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 PHP engine generating 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.

Features

  • Parse files written in various mark up languages (currently Markdown or reStructuredText), and render them to a set of HTML files based on the given templates.
  • Provide various metadata for each page.
  • Configuration file (YAML).
  • Hierarchical Pages.
  • Copy site resources (images, CSS, etc) to the output directory automatically.
  • Access to the page hierarchy from templates.
  • Self-serving test server.

Planned features

  • Only regenerate pages that need it.
  • Support for more mark up languages (next up: ???)

Content

Content is written as Markdown formatted text (parsed with Python Markdown) 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.

More Info

Templates

This content is then 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 more info, see Templates.

Media

Any files in the media directory will be copied to the output directory. If a file is generated that has a file name conflict, it will overwrite the media file.

This feature is useful for images, css, javascript, etc.

Configuration

Settings can be changed in the file config in the current directory.

Possible configuration options (and their defaults) are

  • output_dir ('output') - Where the outputted files are put.
  • content_dir ('content') - Where to find the content.
  • templates_dir ('templates') - Where the templates are.
  • media_dir ('media') - Where the media files are copied from.
  • site_title ('Some Random Wok Site')
Clone this wiki locally