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
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)
[9]13* Easy to learn
[66]14* Code highlighting with [bfchroma](https://github.com/Depado/bfchroma)
[65]15* Fast (duh!)
[9]16
17## Installation
18
[56]19Build it manually assuming you have Go installed:
[9]20
[61]21 $ go install marisa.chaotic.ninja/aya/cmd/aya@latest
[65]22 --- or ---
23 $ git clone https://git.chaotic.ninja/yakumo.izuru/aya
24 $ cd aya
25 $ make
26 # make install
27
[9]28## Ideology
29
[48]30Keep your texts in markdown, or HTML format right in the main directory
[39]31of your blog/site.
[9]32
33Keep all service files (extensions, layout pages, deployment scripts etc)
[56]34in the `.aya` subdirectory.
[9]35
[39]36Define variables in the header of the content files using [YAML]:
[9]37
38 title: My web site
39 keywords: best website, hello, world
[39]40 ---
[9]41
[39]42 Markdown text goes after a header *separator*
[9]43
44Use placeholders for variables and plugins in your markdown or html
[39]45files, e.g. `{{ title }}` or `{{ command arg1 arg2 }}.
[9]46
[56]47Write extensions in any language you like and put them into the `.aya`
[9]48subdiretory.
49
50Everything the extensions prints to stdout becomes the value of the
51placeholder.
52
[56]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:
[9]54
[56]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
[9]59
60## Example of RSS generation
61
[39]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]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
[39]83```
84
[9]85## Hooks
86
87There are two special plugin names that are executed every time the build
[39]88happens - `prehook` and `posthook`. You can define some global actions here like
89content generation, or additional commands, like LESS to CSS conversion:
[9]90
[56]91 # .aya/post
[9]92
93 #!/bin/sh
[56]94 lessc < $AYA_OUTDIR/styles.less > $AYA_OUTDIR/styles.css
95 rm -f $AYA_OUTDIR/styles.css
[9]96
[65]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
[9]102## Command line usage
103
[56]104`aya build` re-builds your site.
[9]105
[56]106`aya build <file>` re-builds one file and prints resulting content to stdout.
[39]107
[61]108`aya serve` serves your site over HTTP.
[9]109
[56]110`aya var <filename> [var1 var2...]` prints a list of variables defined in the
[9]111header of a given markdown file, or the values of certain variables (even if
112it's an empty string).
113
[61]114`aya watch` rebuilds your site every time you modify any file.
115
[9]116## License
117
118The software is distributed under the MIT license.
Note: See TracBrowser for help on using the repository browser.