igorw / balrog
The tiny static site generator.
Requires
- lisphp/lisphp: 1.1.*@dev
- michelf/php-markdown: 1.3.*@dev
- silex/silex: 1.0.*@dev
- symfony/yaml: 2.1.*
- twig/twig: 1.9.*
This package is not auto-updated.
Last update: 2024-10-26 14:02:05 UTC
README
The tiny static site generator written in lisphp.
Usage
To start a new site, just add the dependency via composer:
$ composer init --require igorw/balrog:dev-master -n
Now you can add the following directories:
-
assets: All of these files will be copied to the web directory. You can add JavaScript, CSS and images in here.
-
layouts: The layouts are used to render the pages. They have a
.html.twig
suffix. You can create base templates and have more specific ones that extend them using theextends
tag.Layouts get access to following variables:
-
post: Contains the data of the current post (it is not set on the index page). A post has
title
,body
and any additional front-matter meta data.body
contains the markdown body rendered as html. -
posts: A listing of all posts in reverse order of publication.
Filenames that follow the
index.$format.twig
naming scheme will get compiled to anindex.$format
file. -
-
posts: Markdown files representing blog posts. Must be in the format of
YYYY-mm-dd-slug.md
, e.g.2012-09-20-like-a-hacker.md
. Each one must begin with a YAML front matter. Here is a sample blog post:--- layout: post title: Blogging Like a Hacker --- # Blogging Like a Hacker * I’m bloggin yo! * ORLY? * YARLY!
The following fields are defined:
- title: Title of the blog post for display on the index.
- layout: Layout to be used for rendering this post. Defaults to
default
, which meanslayouts/default.html.twig
is rendered unless specified otherwise. - hidden: Set this to true to hide a post from the index.
Other fields can be defined at will and used in the template.
In order to build the site, you can use the balrog build
command:
$ vendor/bin/balrog build
This will populate the static
directory with a set of files that can be
deployed onto any static web server.
Quote of the day
"Fly, you fools!" - Gandalf