descriptionThe fastest static site generator
homepage URLhttps://suzunaan.chaotic.ninja/aya/
owneryakumo.izuru@chaotic.ninja
last changeSat, 21 Sep 2024 12:42:44 +0000 (21 09:42 -0300)
content tags
add:
README.md

aya

aya is an extremely minimal static site generator written in Go.

Named after Aya Shameimaru from Touhou 9.5: Shoot the Bullet

Features

Installation

Build it manually provided you have Go (>=1.17) installed:

    $ go install marisa.chaotic.ninja/aya/cmd/aya@latest (1)
    --- or ---
    $ git clone https://git.chaotic.ninja/yakumo_izuru/aya
    $ cd aya
    $ make
    # make install

(1) If you use this method, the aya version subcommand may print the wrong string, but it should not be a problem unless you use it on a page.

You can also disable certain features at build time, with the -tags switch. Currently, these tags are available: noamber, nogcss. See go help buildconstraint for more details.

Ideology

Keep your texts in markdown, amber, or html format right in the main directory of your blog/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 }}.

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

Everything the extensions prints to stdout 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 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

Note, you can also place .gcss files for gcss to process instead

Command line usage

Read aya(1)

License

The software is distributed under the MIT/X11 license.

Sites using Aya!

(I know, I made the majority of them, but they still count)

TitleAuthorLink
Aya (project homepage)Izuru Yakumohttps://aya.chaotic.ninja
Chaotic NinjaIzuru Yakumo, Mima-samahttps://chaotic.ninja
GeidonteiIzuru Yakumohttps://geidontei.chaotic.ninja
ChaoticIRC NetworkIzuru Yakumohttps://im.chaotic.ninja
KanakoIzuru Yakumohttps://kanako.chaotic.ninja
Kill-9 The RevivalVarious authorshttps://kill-9.chaotic.ninja
PXIMG(7)Izuru Yakumohttps://pximg.chaotic.ninja
ShinmyoumaruMima-samahttps://shinmyoumaru.chaotic.ninja
SuikaIzuru Yakumohttps://suika.chaotic.ninja
TechnicalMarisaIzuru Yakumohttps://technicalmarisa.chaotic.ninja
Tengu SpaceDeviousTenguhttps://tengu.space
WindowMaker ShrineIzuru Yakumohttps://themes.chaotic.ninja

Ayaya~

shortlog
2024-09-21 Izuru YakumoI activate this card!master
2024-09-21 Izuru YakumoMake use of cross-compilation
2024-09-20 Izuru YakumoThe homepage is on Suzunaan Software Library now
2024-06-17 Izuru Yakumolint
2024-04-03 Izuru YakumoAdd support for disabling features at build time
2024-03-26 Izuru Yakumoとにかく、「aya.PrintVersion」は何か特別なことをするわけではありません
2024-03-26 Izuru Yakumoうーん
2024-03-26 Izuru Yakumo何をしていたか忘れてしまった
2024-03-26 Izuru YakumoAdd posthook examples
2023-12-12 Izuru YakumoI keep inserting random bugs
2023-12-12 Izuru YakumoUpdate README
2023-12-12 Izuru YakumoA good time to finally release a stable version
2023-12-11 Izuru YakumoSeparate the build<FORMAT> functions into their own...
2023-12-10 Izuru YakumoJust a documentation update
2023-12-04 Izuru YakumoPassed through golint only to get a load of garbage
2023-12-04 Izuru YakumoThe Emperor (IV)
...
heads
2 months ago master