source: code/trunk/README.md@ 66

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

Add support for bfchroma syntax highlighting

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

File size: 3.9 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
14* Code highlighting with [bfchroma](https://github.com/Depado/bfchroma)
15* Fast (duh!)
16
17## Installation
18
19Build it manually assuming you have Go installed:
20
21 $ go install marisa.chaotic.ninja/aya/cmd/aya@latest
22 --- or ---
23 $ git clone https://git.chaotic.ninja/yakumo.izuru/aya
24 $ cd aya
25 $ make
26 # make install
27
28## Ideology
29
30Keep your texts in markdown, or HTML format right in the main directory
31of your blog/site.
32
33Keep all service files (extensions, layout pages, deployment scripts etc)
34in the `.aya` subdirectory.
35
36Define variables in the header of the content files using [YAML]:
37
38 title: My web site
39 keywords: best website, hello, world
40 ---
41
42 Markdown text goes after a header *separator*
43
44Use placeholders for variables and plugins in your markdown or html
45files, e.g. `{{ title }}` or `{{ command arg1 arg2 }}.
46
47Write extensions in any language you like and put them into the `.aya`
48subdiretory.
49
50Everything the extensions prints to stdout becomes the value of the
51placeholder.
52
53Every variable from the content header will be passed via environment variables like `title` becomes `$AYA_TITLE` and so on. There are some special variables:
54
55* `$AYA` - a path to the `aya` executable
56* `$AYA_OUTDIR` - a path to the directory with generated files
57* `$AYA_FILE` - a path to the currently processed markdown file
58* `$AYA_URL` - a URL for the currently generated page
59
60## Example of RSS generation
61
62Extensions 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:
63
64``` bash
65#!/bin/sh
66echo "Generating RSS feed"
67
68echo '<?xml version="1.0" encoding="utf-8"?>' > $AYA_OUTDIR/blog/rss.xml
69echo '<rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/">' >> $AYA_OUTDIR/blog/rss.xml
70echo '<channel>' >> $AYA_OUTDIR/blog/rss.xml
71for f in ./blog/*/*.md ; do
72 d=$($AYA var $f date)
73 if [ ! -z $d ] ; then
74 timestamp=`gdate --date "$d" +%s`
75 url=`$AYA var $f url`
76 title=`$AYA var $f title | tr A-Z a-z`
77 descr=`$AYA var $f description`
78 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>"
79 fi
80done | sort -r -n | cut -d' ' -f2- >> $AYA_OUTDIR/blog/rss.xml
81echo '</channel>' >> $AYA_OUTDIR/blog/rss.xml
82echo '</rss>' >> $AYA_OUTDIR/blog/rss.xml
83```
84
85## Hooks
86
87There are two special plugin names that are executed every time the build
88happens - `prehook` and `posthook`. You can define some global actions here like
89content generation, or additional commands, like LESS to CSS conversion:
90
91 # .aya/post
92
93 #!/bin/sh
94 lessc < $AYA_OUTDIR/styles.less > $AYA_OUTDIR/styles.css
95 rm -f $AYA_OUTDIR/styles.css
96
97## Extras
98
99`aya` also supports generating `.html` and `.css` by means of using `.amber`
100and `.gcss` files. See more at [eknkc/amber](https://github.com/eknkc/amber) [yosssi/gcss](https://github.com/yosssi/gcss)
101
102## Command line usage
103
104`aya build` re-builds your site.
105
106`aya build <file>` re-builds one file and prints resulting content to stdout.
107
108`aya serve` serves your site over HTTP.
109
110`aya var <filename> [var1 var2...]` prints a list of variables defined in the
111header of a given markdown file, or the values of certain variables (even if
112it's an empty string).
113
114`aya watch` rebuilds your site every time you modify any file.
115
116## License
117
118The software is distributed under the MIT license.
Note: See TracBrowser for help on using the repository browser.