source: code/trunk/README.md@ 59

Last change on this file since 59 was 56, checked in by Izuru Yakumo, 2 years ago

The fastest, period.

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

File size: 3.0 KB
RevLine 
[56]1# aya
[9]2
[56]3aya is an extremely minimal static site generator written in Go.
[9]4
[56]5This crow tengu stands for 'the fastest one in Gensokyo' and yes this is also a Touhou Project reference.
[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)
[9]13* Easy to learn
14* Fast
15
16## Installation
17
[56]18Build it manually assuming you have Go installed:
[9]19
[56]20 $ go install marisa.chaotic.ninja/aya@latest
[9]21
22## Ideology
23
[48]24Keep your texts in markdown, or HTML format right in the main directory
[39]25of your blog/site.
[9]26
27Keep all service files (extensions, layout pages, deployment scripts etc)
[56]28in the `.aya` subdirectory.
[9]29
[39]30Define variables in the header of the content files using [YAML]:
[9]31
32 title: My web site
33 keywords: best website, hello, world
[39]34 ---
[9]35
[39]36 Markdown text goes after a header *separator*
[9]37
38Use placeholders for variables and plugins in your markdown or html
[39]39files, e.g. `{{ title }}` or `{{ command arg1 arg2 }}.
[9]40
[56]41Write extensions in any language you like and put them into the `.aya`
[9]42subdiretory.
43
44Everything the extensions prints to stdout becomes the value of the
45placeholder.
46
[56]47Every variable from the content header will be passed via environment variables like `title` becomes `$AYA_TITLE` and so on. There are some special variables:
[9]48
[56]49* `$AYA` - a path to the `aya` executable
50* `$AYA_OUTDIR` - a path to the directory with generated files
51* `$AYA_FILE` - a path to the currently processed markdown file
52* `$AYA_URL` - a URL for the currently generated page
[9]53
54## Example of RSS generation
55
[39]56Extensions 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:
57
58``` bash
59for f in ./blog/*.md ; do
[56]60 d=$($AYA var $f date)
[39]61 if [ ! -z $d ] ; then
62 timestamp=`date --date "$d" +%s`
[56]63 url=`$AYA var $f url`
64 title=`$AYA var $f title | tr A-Z a-z`
65 descr=`$AYA var $f description`
[39]66 echo $timestamp \
67 "<item>" \
68 "<title>$title</title>" \
[56]69 "<link>http://ayaerge.com/$url</link>" \
[39]70 "<description>$descr</description>" \
71 "<pubDate>$(date --date @$timestamp -R)</pubDate>" \
[56]72 "<guid>http://ayaerge.com/$url</guid>" \
[39]73 "</item>"
74 fi
75done | sort -r -n | cut -d' ' -f2-
76```
77
[9]78## Hooks
79
80There are two special plugin names that are executed every time the build
[39]81happens - `prehook` and `posthook`. You can define some global actions here like
82content generation, or additional commands, like LESS to CSS conversion:
[9]83
[56]84 # .aya/post
[9]85
86 #!/bin/sh
[56]87 lessc < $AYA_OUTDIR/styles.less > $AYA_OUTDIR/styles.css
88 rm -f $AYA_OUTDIR/styles.css
[9]89
90## Command line usage
91
[56]92`aya build` re-builds your site.
[9]93
[56]94`aya build <file>` re-builds one file and prints resulting content to stdout.
[39]95
[56]96`aya watch` rebuilds your site every time you modify any file.
[9]97
[56]98`aya var <filename> [var1 var2...]` prints a list of variables defined in the
[9]99header of a given markdown file, or the values of certain variables (even if
100it's an empty string).
101
102## License
103
104The software is distributed under the MIT license.
Note: See TracBrowser for help on using the repository browser.