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.
aya build
, and done!)Requires Go 1.17 or higher.
$ git clone https://git.chaotic.ninja/yakumo.izuru/aya
$ cd aya
$ make
# Alternatively can be installed in your $HOME prefix of choice
# make install
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: Aya
description: The fastest static site generator
keywords: ayaya
---
Markdown text goes after a header *separator*
Use placeholders1 for variables and plugins in your markdown or html files, e.g. { title }
or { command arg1 arg2 }
.
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:
$AYA
— path to the aya
executable$AYA_OUTDIR
— a path to the directory with generated files$AYA_FILE
— a path to the currently processed markdown file$AYA_URL
— a URL for the currently generated pageExtensions 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>https://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
There are two special plugin names that are executed every time the build happens - prehook
and posthook
. You can define some global action
s 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.
See aya(1)
The software is distributed under the MIT/X11 license.