comparison README.md @ 55:c6785950280e draft

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