1
0
mirror of https://git.sr.ht/~adnano/kiln synced 2024-09-20 02:32:58 +02:00
kiln/doc/kiln.1.scd

181 lines
4.3 KiB
Plaintext
Raw Normal View History

2020-11-11 01:35:56 +01:00
kiln(1)
# NAME
kiln - a simple static site generator for Gemini sites
# SYNOPSIS
2020-11-20 18:07:38 +01:00
_kiln_ [--html]
# OPTIONS
\--html
If this flag is present, kiln will output HTML as well as Gemini text.
2020-11-11 01:35:56 +01:00
# SITE STRUCTURE
2020-11-20 18:07:38 +01:00
A kiln site is structured in the following way:
2020-11-11 01:35:56 +01:00
2020-11-20 18:07:38 +01:00
[[ *Directory*
2020-11-11 01:35:56 +01:00
:[ *Description*
| src/
: Site source
| templates/
2020-11-20 18:07:38 +01:00
: Site templates
2020-11-11 01:35:56 +01:00
| dst/
: Site destination
2020-11-20 18:07:38 +01:00
| html/
2020-11-11 01:35:56 +01: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 21:51:07 +01:00
Any file or directory whose name begins with "\_" will be ignored.
2020-11-11 01:35:56 +01:00
# TEMPLATES
2020-11-20 18:07:38 +01:00
kiln looks for templates in the *templates* directory.
2020-11-25 02:02:42 +01:00
Templates use the Go templating language.
2020-11-20 18:07:38 +01:00
The following templates are supported:
2020-11-11 01:35:56 +01:00
2020-11-20 18:07:38 +01:00
[[ *Template*
2020-11-11 01:35:56 +01:00
:[ *Description*
| page.gmi
: Page template
| index.gmi
: Directory index template
2020-11-22 21:51:07 +01:00
| atom.xml
: Atom feed template
2020-11-11 01:35:56 +01:00
| output.html
2020-11-20 18:07:38 +01:00
: HTML output template
2020-11-22 21:51:07 +01: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 18:07:38 +01: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 21:51:07 +01:00
: The title of the site.
| URL
: The URL of the site.
To configure these variables, see *CONFIGURATION*.
2020-11-11 01:35:56 +01:00
## PAGE TEMPLATES
Page templates are provided with the following information:
2020-11-20 18:07:38 +01:00
[[ *Variable*
2020-11-11 01:35:56 +01:00
:[ *Description*
| Title
: The title of the page
| Date
: The date of the page
2020-11-20 18:07:38 +01:00
| Path
: Path to the page
2020-11-11 01:35:56 +01:00
| Content
: The contents of the page
Pages can specify dates in their filenames.
2020-11-25 20:33:07 +01: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 01:35:56 +01:00
2020-11-20 18:07:38 +01: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 01:35:56 +01:00
## INDEX TEMPLATES
Index templates are provided with the following information:
2020-11-20 18:07:38 +01:00
[[ *Variable*
2020-11-11 01:35:56 +01:00
:[ *Description*
| Title
: Title of the directory
| Content
: The contents of the directory index file
2020-11-20 18:07:38 +01:00
| Path
: Path to the directory
2020-11-11 01:35:56 +01:00
| Pages
: List of pages in this directory
2020-11-20 18:07:38 +01:00
| Dirs
2020-11-11 01:35:56 +01: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 21:51:07 +01:00
The default index template implements the lightweight subscription specification found at gemini://gemini.circumlunar.space/docs/companion/subscription.gmi.
2020-11-20 18:07:38 +01:00
## FEED TEMPLATES
2020-11-11 01:35:56 +01:00
2020-11-22 21:51:07 +01:00
Atom feed templates are provided with the following information:
2020-11-11 01:35:56 +01:00
2020-11-20 18:07:38 +01:00
[[ *Variable*
:[ *Description*
| Title
: Title of the feed
| Path
: Path to the feed directory
| Entries
2020-11-22 21:51:07 +01:00
: List of pages in this feed
2020-11-11 01:35:56 +01:00
2020-11-22 21:55:06 +01:00
Feeds are written to the directory path plus "atom.xml".
2020-11-11 01:35:56 +01:00
2020-11-22 22:07:37 +01:00
The default feed template uses the site URL, if present, to make relative links into absolute URLs.
2020-11-20 18:07:38 +01:00
## HTML TEMPLATES
HTML output templates are provided with the following information:
[[ *Variable*
2020-11-11 01:35:56 +01:00
:[ *Description*
2020-11-20 18:07:38 +01:00
| Title
: Title of the page
| Content
: HTML contents of the page
2020-11-11 01:35:56 +01:00
# CONFIGURATION
kiln looks for a configuration file named "config.ini".
2020-11-22 21:51:07 +01:00
2020-11-11 01:35:56 +01:00
The configuration file uses the _ini_ format.
2020-11-22 21:51:07 +01: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 01:35:56 +01:00
The following keys are supported:
2020-11-20 18:07:38 +01:00
[[ *Key*
2020-11-11 01:35:56 +01:00
:[ *Description*
| title
: Site title
2020-11-22 21:51:07 +01:00
| url
2020-11-28 00:24:31 +01:00
: Site URL.
Site URLs are only used when generating Atom feeds.
Site URLs should not end with a trailing slash.
More than one site URL may be specified by specifying multiple url keys.
This allows a site that is hosted on both Gemini and HTTP to specify URLs for both locations.
2020-11-20 18:07:38 +01:00
The following sections are supported:
[[ *Section*
:[ *Description*
| feeds
2020-11-22 21:51:07 +01: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 21:55:06 +01:00