source: code/trunk/README.md@ 91

Last change on this file since 91 was 91, checked in by Izuru Yakumo, 3 weeks ago

Update repository URLs

File size: 3.8 KB
Line 
1# aya
2
3aya is an extremely minimal static site generator written in Go.
4
5Named 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
18Build it manually provided you have Go (>=1.17) installed:
19
20 $ go install mahou-no-mori.yakumo.dev/aya/cmd/aya@latest (1)
21 --- or ---
22 $ git clone https://git.mentality.rip/novaburst/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,
28but it should not be a problem unless you use it on a page.
29
30You can also disable certain features at build time, with the `-tags` switch.
31Currently, these tags are available: `noamber`, `nogcss`.
32See `go help buildconstraint` for more details.
33
34## Ideology
35
36Keep your texts in markdown, [amber](https://github.com/eknkc/amber), or html format right in the main directory
37of your blog/site.
38
39Keep all service files (extensions, layout pages, deployment scripts etc)
40in the `.aya` subdirectory.
41
42Define variables in the header of the content files using [YAML](https://noyaml.com) :
43
44```markdown
45title: My web site
46keywords: best website, hello, world
47---
48
49Markdown text goes after a header *separator*
50```
51
52Use placeholders for variables and plugins in your markdown or html
53files, e.g. `{{ title }}` or `{{ command arg1 arg2 }}.
54
55Write extensions in any language you like and put them into the `.aya`
56subdiretory.
57
58Everything the extensions prints to [stdout](https://man.freebsd.org/cgi/man.cgi?fd) becomes the value of the
59placeholder.
60
61Every variable from the content header will be passed via environment variables like `title` becomes `$AYA_TITLE` and so on.
62There 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
71Extensions 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
75echo "Generating RSS feed"
76
77echo '<?xml version="1.0" encoding="utf-8"?>' > $AYA_OUTDIR/blog/rss.xml
78echo '<rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/">' >> $AYA_OUTDIR/blog/rss.xml
79echo '<channel>' >> $AYA_OUTDIR/blog/rss.xml
80for 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.yakumo.dev/blog/$url</link><description>$descr</description><pubDate>$(gdate --date @$timestamp -R)</pubDate><guid>http://technicalmarisa.yakumo.dev/blog/$url</guid></item>"
88 fi
89done | sort -r -n | cut -d' ' -f2- >> $AYA_OUTDIR/blog/rss.xml
90echo '</channel>' >> $AYA_OUTDIR/blog/rss.xml
91echo '</rss>' >> $AYA_OUTDIR/blog/rss.xml
92```
93
94## Hooks
95There are two special plugin names that are executed every time the build
96happens - `prehook` and `posthook`. You can define some global actions here like
97content generation, or additional commands, like LESS to CSS conversion
98
99Note, you can also place `.gcss` files for [gcss](https://github.com/yosssi/gcss) to process instead
100
101## Command line usage
102Read `aya(1)`
103
104## License
105The software is distributed under the [MIT/X11](LICENSE) license.
106
107---
108
109Ayaya~
Note: See TracBrowser for help on using the repository browser.