gssg

command module
v0.0.0-...-fc755f2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 29, 2023 License: GPL-3.0 Imports: 14 Imported by: 0

README

gssg

A gemini static site generator

gssg will:

  • Read files from a source directory
  • Apply the index template for index pages or page template for other pages
  • Copy the files to the destination directory
  • Generate the feed, if configured

Apart from the feed, no other files will be generated. gssg will only act on files from the source directory.

Usage

Initialize a new site with gssg -init:

gssg -init example.com

This will create the following structure:

example.com
├── config.toml
├── content
│   └── index.gmi
└── templates
    ├── atom.xml
    ├── index.gmi
    └── page.gmi

The default template expects posts on the content/posts folder, and it will display them on the index.gmi page ordered by date.

At this point, you have a working gssg installation. To generate the site, just run:

gssg
Dates

Dates will be populated on the page information via the filename or the contents of the file.

If the filename has a YYYY-MM-DD string, that will be counted as date, if not, gssg will search in the file contents for the first entry of YYYY-MM-DD and use that as date.

Configuration

Configuration will be made through the config.toml file in the root of the site.

Available configuration options:

# Mandatory options
title = "anon's gemlog" # Title of the gemlog
url = "example.com" # URL of the gemlog
source_dir = "content" # Directory of the source files
dest_dir = "public" # Directory of the generated files

# Optional
template_dir = "templates" # Directory for the templates
feed_title = "posts anon's gemlog" # Atom Feed name
feed_path = "posts/" # Directory on source_dir to search for articles for the feed

Templates

There's three available templates at the moment, page.gmi, index.gmi and atom.xml

Page template variables
  • Content (Raw content of the file, this does not strip the title)
  • Title (Title of the page, will be populated from the first heading found in the page)
  • Date (Date of the page, will search for YYYY-MM-DD on the filename or in the content)
  • Permalink
  • Config.URL (Main URL of the page)
Index template variables
  • Same as page
  • Children (Map of children posts with the key as the relative directory and the value as a slice of non index.gmi Posts)
Atom feed variables
  • Title (feed_title from config.toml)
  • Path (feed_path from config.toml)
  • URL (url from config.toml)
  • Updated (The time this file was last generated)
  • Entries (Array of Pages found on feed_path)

Building

make
make install

Contributing

Patches and questions? Send to my public inbox: ~gsthnz/public-inbox@lists.sr.ht. Thanks!

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL