Aya Shameimaru artwork by XenoderA

aya is an extremely fucking fast and (not quite) minimal static site generator written in Go.

It’s named after Aya Shameimaru from Touhou Kaeizuka ~ Phantasmagoria of Flower View.

Features

Installation

Requires Go 1.17 or higher.

$ go install marisa.chaotic.ninja/aya/cmd/aya@latest

or

$ git clone https://git.chaotic.ninja/yakumo.izuru/aya
$ cd aya
$ make
# make install

Ideology

Keep your texts in markdown, amber, or html format right in the main directory of your blog or site.
Keep all service files (extensions, layout pages, deployment scripts, etc) in the .aya subdirectory.

Define variables in the header of the content files using YAML

---
title: My web site
keywords: best website, hello, world
---

Markdown text goes after a header *separator*

Use placeholders for variables and plugins in your markdown or html files, e.g. [[ title ]] or [[ command arg1 arg2 ]].
(Note: they are curly braces instead)

Write extensions in any language you like and put them into the .aya subdirectory.

Everything the extensions print to standard output becomes the value of the placeholder.

Every variable from the content header will be passed via environment variables like title becomes $AYA_TITLE and so on. There are some special variables:

Example of RSS/Atom feed generation

Extensions can be written in any language you know (Bash, Python, Lua, JavaScript, Go, even Assembler). Here’s an example of how to scan all markdown blog posts and create RSS items:

#!/bin/sh
echo "Generating RSS feed"

echo '<?xml version="1.0" encoding="utf-8"?>' > $AYA_OUTDIR/blog/rss.xml
echo '<rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/">' >> $AYA_OUTDIR/blog/rss.xml
echo '<channel>' >> $AYA_OUTDIR/blog/rss.xml
for f in ./blog/*/*.md ; do
    d=$($AYA var $f date)
    if [ ! -z $d ] ; then
        timestamp=`gdate --date "$d" +%s`
        url=`$AYA var $f url`
        title=`$AYA var $f title | tr A-Z a-z`
        descr=`$AYA var $f description`
        echo $timestamp "<item><title>$title</title><link>https://technicalmarisa.chaotic.ninja/blog/$url</link>
		<description>$descr</description><pubDate>$(gdate --date @$timestamp -R)</pubDate>
		<guid>http://technicalmarisa.chaotic.ninja/blog/$url</guid></item>"
    fi
done | sort -r -n | cut -d' ' -f2- >> $AYA_OUTDIR/blog/rss.xml
echo '</channel>' >> $AYA_OUTDIR/blog/rss.xml
echo '</rss>' >> $AYA_OUTDIR/blog/rss.xml

Hooks

There are two special plugin names that are executed every time the build happens - prehook and posthook. You can define some global actions here like content generation, or additional commands, like LESS to CSS conversion:

#!/bin/sh
lessc < $AYA_OUTDIR/styles.less > $AYA_OUTDIR/styles.css
rm -f $AYA_OUTDIR/styles.css

An alternative method of generating CSS is placing .gcss files for gcss to process.

Command line usage

See aya(1)

License

The software is distributed under the MIT/X11 license.

Sites using this software


Generated with aya v1.0.1