ashes999 / butterfly

Haxe generator for simple, static blogs.
28 stars 1 forks source link

logo

Butterfly build status

Simple, beautiful, static websites. Butterfly combines Markdown files, JSON data, and your HTML layout file to produce a static website. Perfect for hosting on websites like GitHub Pages!

Prerequisites

You need to install:

Generating Your Site

Quick-Start

Run ./run.sh or ./run.bat and specify where your website files are:

./run.sh /home/myblog

Your website files must include, at a minimum, a src directory with the following:

Output appears in the bin directory, a sibling-directory to src.

For an example repository, check out my Learn Haxe blog repository.

What's Generated

Butterfly generates:

OpenGraph Support

Butterfly includes very limited support for OpenGraph, and tries to behave sensibly out of the box:

JSON Configuration

Butterfly requires a config.json file. At a minimum, it should , contains the following fields: siteName, siteUrl, and authorName (these are used for Atom feed generation).

Required Attributes

A minimal config.json file looks like this:

{
  "siteName": "Learn Haxe",
  "siteUrl": "http://ashes999.github.io/learnhaxe",
  "authorName": "ashes999",
}

Optional Attributes

Layout.html (Template File)

Every butterfly site needs a layout.html file. This contains the template page that we use and populate with content (pages, posts, etc.).

Required Tags

Your layout file needs the following tags:

Optional Tags

You can add the following optional fields in your layout:

Variables

Variables in your config file can be rendered in the final HTML if you put $variable-like placeholders in your layout template.

In your layout template, you can specify the value of any config file property, prefixed with a $, to substitute it for the value. For example, with a config that includes "siteName": "Learn Haxe", your layout may include:

<h2>$siteName</h2>

This will generate the following HTML:

<h2>Learn Haxe</h2>

Post/Page Content

In general, any Markdown content will work. If you run into trouble, open an issue and let us know so we can investigate and hopefully resolve it.

Meta-Data

Some meta-data applies only to posts; some applies only to pages; some applies to both.

Common Meta-Data

Posts Only

Pages Only

Generated Meta-Data

The following meta-data is automatically inserted, and shouldn't be changed/deleted (unless you are really sure that know what you're doing):

Contributing

We welcome contributions to Butterfly. Please note that you must write unit tests to cover any new code, and all existing tests must pass (otherwise, the build fails).