[9] | 1 | zs
|
---|
| 2 | ==
|
---|
| 3 |
|
---|
[13] | 4 | [](https://travis-ci.org/zserge/zs)
|
---|
| 5 |
|
---|
[9] | 6 | zs is an extremely minimal static site generator written in Go.
|
---|
| 7 |
|
---|
| 8 | It's inspired by `zas` generator, but is even more minimal.
|
---|
| 9 |
|
---|
| 10 | The name stands for 'zen static' as well as it's my initials.
|
---|
| 11 |
|
---|
| 12 | ## Features
|
---|
| 13 |
|
---|
| 14 | * Zero configuration (no configuration file needed)
|
---|
| 15 | * Cross-platform
|
---|
| 16 | * Highly extensible
|
---|
| 17 | * Easy to learn
|
---|
| 18 | * Fast
|
---|
| 19 |
|
---|
| 20 | ## Installation
|
---|
| 21 |
|
---|
| 22 | Download the binaries from Github or build it manually:
|
---|
| 23 |
|
---|
| 24 | $ go get github.com/zserge/zs
|
---|
| 25 |
|
---|
| 26 | ## Ideology
|
---|
| 27 |
|
---|
| 28 | Keep your texts in markdown format in the root directory of your blog/site.
|
---|
| 29 |
|
---|
| 30 | Keep all service files (extensions, layout pages, deployment scripts etc)
|
---|
| 31 | in the `.zs` subdirectory.
|
---|
| 32 |
|
---|
| 33 | Define variables in the header of the markdown files:
|
---|
| 34 |
|
---|
| 35 | title: My web site
|
---|
| 36 | keywords: best website, hello, world
|
---|
| 37 |
|
---|
| 38 | Markdown text goes after a *newline*
|
---|
| 39 |
|
---|
| 40 | Use placeholders for variables and plugins in your markdown or html
|
---|
| 41 | files, e.g. `{{ title }}`.
|
---|
| 42 |
|
---|
| 43 | Write extensions in any language you like and put them into the `.zs`
|
---|
| 44 | subdiretory.
|
---|
| 45 |
|
---|
| 46 | Everything the extensions prints to stdout becomes the value of the
|
---|
| 47 | placeholder.
|
---|
| 48 |
|
---|
| 49 | Extensions can use special environment variables, like:
|
---|
| 50 |
|
---|
| 51 | * `$ZS` - a path to the `zs` executable
|
---|
| 52 | * `$ZS_OUTDIR` - a path to the directory with generated files
|
---|
| 53 | * `$ZS_FILE` - a path to the currently processed markdown file
|
---|
| 54 | * `$ZS_URL` - a URL for the currently generated page
|
---|
| 55 |
|
---|
| 56 | You can also pass command line arguments, e.g: `{{ my-plugin arg1 arg2 }}`
|
---|
| 57 |
|
---|
| 58 | ## Example of RSS generation
|
---|
| 59 |
|
---|
| 60 | ## Hooks
|
---|
| 61 |
|
---|
| 62 | There are two special plugin names that are executed every time the build
|
---|
| 63 | happens - `pre` and `post`. You can define some global action here like compile
|
---|
| 64 | your LESS to CSS etc:
|
---|
| 65 |
|
---|
| 66 | # .zs/post
|
---|
| 67 |
|
---|
| 68 | #!/bin/sh
|
---|
| 69 | lessc < $ZS_OUTDIR/styles.less > $ZS_OUTDIR/styles.css
|
---|
| 70 | rm -f $ZS_OUTDIR/styles.css
|
---|
| 71 |
|
---|
| 72 | ## Command line usage
|
---|
| 73 |
|
---|
| 74 | `zs build` re-builds your site.
|
---|
| 75 |
|
---|
| 76 | `zs watch` rebuilds your site every time you modify any file.
|
---|
| 77 |
|
---|
| 78 | `zs var <filename> [var1 var2...]` prints a list of variables defined in the
|
---|
| 79 | header of a given markdown file, or the values of certain variables (even if
|
---|
| 80 | it's an empty string).
|
---|
| 81 |
|
---|
| 82 | ## License
|
---|
| 83 |
|
---|
| 84 | The software is distributed under the MIT license.
|
---|