Version 5 (modified by 7 weeks ago) ( diff ) | ,
---|
Aya
An extremely fucking fast and (not quite) minimal static site generator written in Go.
It's named after Aya Shameimaru from Phantasmagoria of Flower View.
Features
- Zero configuration
- Cross-platform
- Highly extensible
- Works well for blogs, documentation pages, and generic static websites
- Easy to learn (make layout, write pages,
aya build
, and done!)
Installation
Requires Go 1.17 or higher.
$ svn co https://svn.chaotic.ninja/svn/aya-yakumo.izuru/trunk aya $ cd aya $ make $ ./aya-OS-ARCH % ...alternatively can be installed wherever you want $ make PREFIX=$HOME/.local install % ...or globally # make install $ aya
Ideology
Keep your texts in Markdown, Amber, or HTML 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: ayayaya --- 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 }}
.
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 theaya
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 page
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:
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
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
This software is distributed under the MIT/X11 license.