1 |
yakumo_izuru |
1.1 |
# aya |
2 |
|
|
|
3 |
|
|
aya is an extremely minimal static site generator written in Go. |
4 |
|
|
|
5 |
|
|
Named after [Aya Shameimaru](https://en.touhouwiki.net/wiki/Aya_Shameimaru) from [Touhou 9.5: Shoot the Bullet](https://en.touhouwiki.net/wiki/Shoot_the_Bullet) |
6 |
|
|
|
7 |
|
|
## Features |
8 |
|
|
|
9 |
|
|
* Zero configuration (no configuration file needed) |
10 |
|
|
* Cross-platform |
11 |
|
|
* Highly extensible |
12 |
|
|
* Works well for blogs and generic static websites (landing pages etc) |
13 |
|
|
* Easy to learn (you literally don't need to) |
14 |
|
|
* Fast (goes without saying) |
15 |
|
|
|
16 |
|
|
## Installation |
17 |
|
|
|
18 |
|
|
Build it manually provided you have Go (>=1.17) installed: |
19 |
|
|
|
20 |
|
|
$ go install marisa.chaotic.ninja/aya/cmd/aya@latest (1) |
21 |
|
|
--- or --- |
22 |
|
|
$ git clone https://git.chaotic.ninja/yakumo_izuru/aya |
23 |
|
|
$ cd aya |
24 |
|
|
$ make |
25 |
|
|
# make install |
26 |
|
|
|
27 |
|
|
(1) If you use this method, the `aya version` subcommand may print the wrong string, |
28 |
|
|
but it should not be a problem unless you use it on a page. |
29 |
|
|
|
30 |
|
|
You can also disable certain features at build time, with the `-tags` switch. |
31 |
|
|
Currently, these tags are available: `noamber`, `nogcss`. |
32 |
|
|
See `go help buildconstraint` for more details. |
33 |
|
|
|
34 |
|
|
## Ideology |
35 |
|
|
|
36 |
|
|
Keep your texts in markdown, [amber](https://github.com/eknkc/amber), or html format right in the main directory |
37 |
|
|
of your blog/site. |
38 |
|
|
|
39 |
|
|
Keep all service files (extensions, layout pages, deployment scripts etc) |
40 |
|
|
in the `.aya` subdirectory. |
41 |
|
|
|
42 |
|
|
Define variables in the header of the content files using [YAML](https://noyaml.com) : |
43 |
|
|
|
44 |
|
|
```markdown |
45 |
|
|
title: My web site |
46 |
|
|
keywords: best website, hello, world |
47 |
|
|
--- |
48 |
|
|
|
49 |
|
|
Markdown text goes after a header *separator* |
50 |
|
|
``` |
51 |
|
|
|
52 |
|
|
Use placeholders for variables and plugins in your markdown or html |
53 |
|
|
files, e.g. `{{ title }}` or `{{ command arg1 arg2 }}. |
54 |
|
|
|
55 |
|
|
Write extensions in any language you like and put them into the `.aya` |
56 |
|
|
subdiretory. |
57 |
|
|
|
58 |
|
|
Everything the extensions prints to [stdout](https://man.freebsd.org/cgi/man.cgi?fd) becomes the value of the |
59 |
|
|
placeholder. |
60 |
|
|
|
61 |
|
|
Every variable from the content header will be passed via environment variables like `title` becomes `$AYA_TITLE` and so on. |
62 |
|
|
There are some special variables: |
63 |
|
|
|
64 |
|
|
* `$AYA` - a path to the `aya` executable |
65 |
|
|
* `$AYA_OUTDIR` - a path to the directory with generated files |
66 |
|
|
* `$AYA_FILE` - a path to the currently processed markdown file |
67 |
|
|
* `$AYA_URL` - a URL for the currently generated page |
68 |
|
|
|
69 |
|
|
## Example of RSS generation |
70 |
|
|
|
71 |
|
|
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: |
72 |
|
|
|
73 |
|
|
``` bash |
74 |
|
|
#!/bin/sh |
75 |
|
|
echo "Generating RSS feed" |
76 |
|
|
|
77 |
|
|
echo '<?xml version="1.0" encoding="utf-8"?>' > $AYA_OUTDIR/blog/rss.xml |
78 |
|
|
echo '<rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/">' >> $AYA_OUTDIR/blog/rss.xml |
79 |
|
|
echo '<channel>' >> $AYA_OUTDIR/blog/rss.xml |
80 |
|
|
for f in ./blog/*/*.md ; do |
81 |
|
|
d=$($AYA var $f date) |
82 |
|
|
if [ ! -z $d ] ; then |
83 |
|
|
timestamp=`gdate --date "$d" +%s` |
84 |
|
|
url=`$AYA var $f url` |
85 |
|
|
title=`$AYA var $f title | tr A-Z a-z` |
86 |
|
|
descr=`$AYA var $f description` |
87 |
|
|
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>" |
88 |
|
|
fi |
89 |
|
|
done | sort -r -n | cut -d' ' -f2- >> $AYA_OUTDIR/blog/rss.xml |
90 |
|
|
echo '</channel>' >> $AYA_OUTDIR/blog/rss.xml |
91 |
|
|
echo '</rss>' >> $AYA_OUTDIR/blog/rss.xml |
92 |
|
|
``` |
93 |
|
|
|
94 |
|
|
## Hooks |
95 |
|
|
There are two special plugin names that are executed every time the build |
96 |
|
|
happens - `prehook` and `posthook`. You can define some global actions here like |
97 |
|
|
content generation, or additional commands, like LESS to CSS conversion |
98 |
|
|
|
99 |
|
|
Note, you can also place `.gcss` files for [gcss](https://github.com/yosssi/gcss) to process instead |
100 |
|
|
|
101 |
|
|
## Command line usage |
102 |
|
|
Read `aya(1)` |
103 |
|
|
|
104 |
|
|
## License |
105 |
|
|
The software is distributed under the [MIT/X11](LICENSE) license. |
106 |
|
|
|
107 |
|
|
## Sites using Aya! |
108 |
|
|
(I know, I made the majority of them, but they still count) |
109 |
|
|
|
110 |
|
|
| Title | Author | Link | |
111 |
|
|
|------------------------|--------------------------------------------------|---------------------------------------| |
112 |
|
|
| Aya (project homepage) | Izuru Yakumo | https://aya.chaotic.ninja | |
113 |
|
|
| Chaotic Ninja | Izuru Yakumo, Mima-sama | https://chaotic.ninja | |
114 |
|
|
| Geidontei | Izuru Yakumo | https://geidontei.chaotic.ninja | |
115 |
|
|
| ChaoticIRC Network | Izuru Yakumo | https://im.chaotic.ninja | |
116 |
|
|
| Kanako | Izuru Yakumo | https://kanako.chaotic.ninja | |
117 |
|
|
| Kill-9 The Revival | Various authors | https://kill-9.chaotic.ninja | |
118 |
|
|
| PXIMG(7) | Izuru Yakumo | https://pximg.chaotic.ninja | |
119 |
|
|
| Shinmyoumaru | Mima-sama | https://shinmyoumaru.chaotic.ninja | |
120 |
|
|
| Suika | Izuru Yakumo | https://suika.chaotic.ninja | |
121 |
|
|
| TechnicalMarisa | Izuru Yakumo | https://technicalmarisa.chaotic.ninja | |
122 |
|
|
| Tengu Space | [DeviousTengu](https://fedi.tengu.space/devious) | https://tengu.space | |
123 |
|
|
| WindowMaker Shrine | Izuru Yakumo | https://themes.chaotic.ninja | |
124 |
|
|
|
125 |
|
|
--- |
126 |
|
|
|
127 |
|
|
Ayaya~ |