kiln/doc/kiln.1.scd

176 lines
4.1 KiB
Plaintext
Raw Normal View History

2020-11-11 00:35:56 +00:00
kiln(1)
# NAME
kiln - a simple static site generator for Gemini sites
# SYNOPSIS
2020-11-20 17:07:38 +00:00
_kiln_ [--html]
# OPTIONS
\--html
If this flag is present, kiln will output HTML as well as Gemini text.
2020-11-11 00:35:56 +00:00
# SITE STRUCTURE
2020-11-20 17:07:38 +00:00
A kiln site is structured in the following way:
2020-11-11 00:35:56 +00:00
2020-11-20 17:07:38 +00:00
[[ *Directory*
2020-11-11 00:35:56 +00:00
:[ *Description*
| src/
: Site source
| templates/
2020-11-20 17:07:38 +00:00
: Site templates
2020-11-11 00:35:56 +00:00
| dst/
: Site destination
2020-11-20 17:07:38 +00:00
| html/
2020-11-11 00:35:56 +00:00
: Site HTML destination
All files in the source directory will be copied to the destination directory.
If the file is a Gemini file, it will be passed through a template and the result will be written to the destination directory.
2020-11-22 20:51:07 +00:00
Any file or directory whose name begins with "\_" will be ignored.
2020-11-11 00:35:56 +00:00
# TEMPLATES
2020-11-20 17:07:38 +00:00
kiln looks for templates in the *templates* directory.
2020-11-25 01:02:42 +00:00
Templates use the Go templating language.
2020-11-20 17:07:38 +00:00
The following templates are supported:
2020-11-11 00:35:56 +00:00
2020-11-20 17:07:38 +00:00
[[ *Template*
2020-11-11 00:35:56 +00:00
:[ *Description*
| page.gmi
: Page template
| index.gmi
: Directory index template
2020-11-22 20:51:07 +00:00
| atom.xml
: Atom feed template
2020-11-11 00:35:56 +00:00
| output.html
2020-11-20 17:07:38 +00:00
: HTML output template
2020-11-22 20:51:07 +00:00
The scope of a template is limited to the directory it is placed in.
For example, the template templates/blog/page.gmi will only apply to pages in src/blog.
kiln has default templates built-in. To override the default templates, put templates in the templates/\_default directory. These templates will apply to any directory which does not have its own templates specified.
2020-11-20 17:07:38 +00:00
## FUNCTIONS
All templates have the following functions available to them:
[[ *Function*
:[ *Description*
| site
: Returns site metadata
## SITE METADATA
Site metadata contains the following information:
[[ *Variable*
:[ *Description*
| Title
2020-11-22 20:51:07 +00:00
: The title of the site.
| URL
: The URL of the site.
To configure these variables, see *CONFIGURATION*.
2020-11-11 00:35:56 +00:00
## PAGE TEMPLATES
Page templates are provided with the following information:
2020-11-20 17:07:38 +00:00
[[ *Variable*
2020-11-11 00:35:56 +00:00
:[ *Description*
| Title
: The title of the page
| Date
: The date of the page
2020-11-20 17:07:38 +00:00
| Path
: Path to the page
2020-11-11 00:35:56 +00:00
| Content
: The contents of the page
Pages can specify dates in their filenames.
2020-11-20 17:07:38 +00:00
For example, src/2020-11-20-Hello-world.gmi will have a path of /Hello-world and a date of November 20, 2020.
2020-11-11 00:35:56 +00:00
2020-11-20 17:07:38 +00:00
Pages can specify a title in a top-level heading line.
The heading must be the first line in the page, and can optionally be followed by a blank line.
Both lines will be removed from the page content.
2020-11-11 00:35:56 +00:00
## INDEX TEMPLATES
Index templates are provided with the following information:
2020-11-20 17:07:38 +00:00
[[ *Variable*
2020-11-11 00:35:56 +00:00
:[ *Description*
| Title
: Title of the directory
| Content
: The contents of the directory index file
2020-11-20 17:07:38 +00:00
| Path
: Path to the directory
2020-11-11 00:35:56 +00:00
| Pages
: List of pages in this directory
2020-11-20 17:07:38 +00:00
| Dirs
2020-11-11 00:35:56 +00:00
: List of subdirectories
The title and content are taken from the index.gmi file in the directory.
If no index.gmi file exists, then the index template will not be rendered.
2020-11-22 20:51:07 +00:00
The default index template implements the lightweight subscription specification found at gemini://gemini.circumlunar.space/docs/companion/subscription.gmi.
2020-11-20 17:07:38 +00:00
## FEED TEMPLATES
2020-11-11 00:35:56 +00:00
2020-11-22 20:51:07 +00:00
Atom feed templates are provided with the following information:
2020-11-11 00:35:56 +00:00
2020-11-20 17:07:38 +00:00
[[ *Variable*
:[ *Description*
| Title
: Title of the feed
| Path
: Path to the feed directory
| Entries
2020-11-22 20:51:07 +00:00
: List of pages in this feed
2020-11-11 00:35:56 +00:00
2020-11-22 20:55:06 +00:00
Feeds are written to the directory path plus "atom.xml".
2020-11-11 00:35:56 +00:00
2020-11-22 21:07:37 +00:00
The default feed template uses the site URL, if present, to make relative links into absolute URLs.
2020-11-20 17:07:38 +00:00
## HTML TEMPLATES
HTML output templates are provided with the following information:
[[ *Variable*
2020-11-11 00:35:56 +00:00
:[ *Description*
2020-11-20 17:07:38 +00:00
| Title
: Title of the page
| Content
: HTML contents of the page
2020-11-11 00:35:56 +00:00
# CONFIGURATION
kiln looks for a configuration file named "config.ini".
2020-11-22 20:51:07 +00:00
2020-11-11 00:35:56 +00:00
The configuration file uses the _ini_ format.
2020-11-22 20:51:07 +00:00
A line beginning with ";" is considered a comment and ignored, as are empty lines.
New sections begin with [section-name] on a single line.
Keys and values are separated with "=".
2020-11-11 00:35:56 +00:00
The following keys are supported:
2020-11-20 17:07:38 +00:00
[[ *Key*
2020-11-11 00:35:56 +00:00
:[ *Description*
| title
: Site title
2020-11-22 20:51:07 +00:00
| url
: Site URL. Should not end with a trailing slash.
2020-11-20 17:07:38 +00:00
The following sections are supported:
[[ *Section*
:[ *Description*
| feeds
2020-11-22 20:51:07 +00:00
: A list of Atom feeds. Keys denote the path to the feed directory, and values denote the title of the feed.
2020-11-22 20:55:06 +00:00