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
$=url
to inject the root URL - Use
$=toc
to inject a table of contents for the page - Set
$key=value
to set data for that post/page:- Set
$time=time_in_epoch_seconds
to set post time - Or
$date=day/month/year
(overrides above) $order=number
sets the order pages appear in the menu$hidden=true
hides 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:
title
to change the site titletemplate
to use a custom templateposts_dir
andpages_dir
change the output dirsindex_page
to use a page as indexsticky_page
to stick a pages contents on top of the first indexlink_dirs = false
build post/pages at/name.html
rather than/name/index.html
get_post_permalink
&get_page_permalink
to 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.