source: code/trunk/README.md@ 86

Last change on this file since 86 was 84, checked in by Izuru Yakumo, 15 months ago

何をしていたか忘れてしまった

Signed-off-by: Izuru Yakumo <yakumo.izuru@…>

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