Luapress v4.0
Markdown goes in, HTML comes out. Luapress is a simple and fast static site/blog generator.
Install with Luarocks:
$ luarocks install luapress
Create a new site in the current directory:
$ luapress init http://mywebsite.com
Drop Markdown files in posts/ & pages/ and build with:
$ luapress
Markdown Extras
Luapress handles a few extensions to normal markdown:
- Use
--MORE--to generate a excerpt/read-more link in posts - Use
[=pages|posts/NAME]to generate crosslinks between posts/pages - Use
$=urlto inject the root URL - Use
$=tocto inject a table of contents for the page - Set
$key=valueto set data for that post/page:- Set
$time=time_in_epoch_secondsto set post time - Or
$date=day/month/year(overrides above) $order=numbersets the order pages appear in the menu$hidden=truehides pages from the menu
- Set
- To ignore all these extras wrap content in
$raw$…$/raw$
Config Options
Modify the auto-generated config.lua to customise the Luapress output:
titleto change the site titletemplateto use a custom templateposts_dirandpages_dirchange the output dirsindex_pageto use a page as indexsticky_pageto stick a pages contents on top of the first indexlink_dirs = falsebuild post/pages at/name.htmlrather than/name/index.htmlget_post_permalink&get_page_permalinkto customize permalinks
All the available options and defaults can be viewed in the default config.
Environments
Multiple environments can be defined in the config file:
config = {
url = 'http://localhost/mysite',
envs = {
production = {
url = 'http://mysite.com',
build_dir = 'production'
}
}
}
To build against envs:
# Builds default (localhost/mysite) to ./build (the default)
$ luapress
# Builds production (mysite.com) to ./production
$ luapress production
Templates
Luapress templates can be written mustache, etlua or LHTML. You only need to worry about a few files:
header.[mustache|etlua|lhtml]footer.[mustache|etlua|lhtml]- One or both of
post.[mustache|etlua|lhtml]&page.[mustache|etlua|lhtml] - Optionally an
archive.[mustache|etlua|lhtml]
The included templates and this website serve as good references for building templates.
Plugins
Plugins can be used like so:
$! MY_PLUGIN arg, arg, arg !$
To use plugins not included with Luapress, just drop them in plugins/ alongside your posts/ and pages/. Plugins must contain an init.lua file which returns a single function. Check out the gallery plugin as a good reference for building plugins.