1
0
mirror of https://github.com/danog/gojekyll.git synced 2025-01-23 07:51:18 +01:00
gojekyll/README.md

227 lines
12 KiB
Markdown
Raw Normal View History

2017-07-01 13:34:32 -04:00
# Gojekyll
2017-07-01 23:54:12 -04:00
2017-07-06 18:18:32 -04:00
[![][travis-svg]][travis-url] [![][coveralls-svg]][coveralls-url] [![][go-report-card-svg]][go-report-card-url] [![][license-svg]][license-url]
2017-07-20 12:30:55 -04:00
Gojekyll is a partially-compatible clone of the [Jekyll](https://jekyllrb.com) static site generator, written in the [Go](https://golang.org) programming language. It provides `build` and `serve` commands, with directory watch and live reload.
2017-07-15 10:59:55 -04:00
2017-07-12 19:15:55 -04:00
|   | Gojekyll | Jekyll | Hugo |
|-------------------------|-------------------------------------------|--------|--------------|
| Stable | | ✓ | ✓ |
2017-07-14 18:29:56 -04:00
| Fast | ✓<br>([~20×Jekyll](./docs/benchmarks.md)) | | ✓ |
2017-07-12 19:15:55 -04:00
| Template language | Liquid | Liquid | Go templates |
2017-07-26 08:01:24 -04:00
| SASS | ✓ | ✓ | |
2017-07-12 19:15:55 -04:00
| Jekyll compatibility | [partial](#current-limitations) | ✓ | |
| Plugins | [some](./docs/plugins.md) | yes | ? |
2017-07-26 08:01:24 -04:00
| Windows support | | ✓ | ✓ |
2017-07-12 19:15:55 -04:00
| Implementation language | Go | Ruby | Go |
2017-07-11 17:44:17 -04:00
2017-07-01 20:24:11 -04:00
<!-- TOC -->
2017-07-01 13:34:32 -04:00
2017-07-01 20:24:11 -04:00
- [Gojekyll](#gojekyll)
- [Usage](#usage)
2017-07-14 18:29:56 -04:00
- [Installation](#installation)
2017-07-20 12:30:55 -04:00
- [Binary Downloads](#binary-downloads)
- [From Source](#from-source)
2017-07-09 13:41:19 -04:00
- [Status](#status)
- [Current Limitations](#current-limitations)
- [Other Differences](#other-differences)
2017-07-09 18:48:49 -04:00
- [Feature Checklist](#feature-checklist)
2017-07-01 20:24:11 -04:00
- [Contributing](#contributing)
2017-07-09 15:21:11 -04:00
- [Attribution](#attribution)
2017-07-01 20:24:11 -04:00
- [Related](#related)
- [License](#license)
<!-- /TOC -->
2017-07-14 18:29:56 -04:00
## Usage
```bash
gojekyll build # builds the site in the current directory into _site
gojekyll serve # serve the app at http://localhost:4000; reload on changes
gojekyll help
gojekyll help build
```
2017-07-01 20:35:05 -04:00
## Installation
2017-07-20 12:30:55 -04:00
### Binary Downloads
1. Ubuntu (64-bit) and macOS binaries are available from the [releases page](https://github.com/osteele/gojekyll/releases).
2017-07-25 12:00:41 -04:00
2. [Optional] **Highlight**. To use the `{% highlight %}` tag, you also need [Pygments](http://pygments.org): `pip install Pygments`.
3. [Optional] **Themes**. To use a theme, you need to create a `Gemfile` that lists the theme, and run (the Ruby command) `bundle install`. The [Jekyll theme instructions](https://jekyllrb.com/docs/themes/) provides more detail, and should work for Gojekyll too.
2017-07-20 12:30:55 -04:00
### From Source
2017-07-14 18:29:56 -04:00
Pre-requisites:
1. **Install go** (1) via [Homebrew](https://brew.sh): `brew install go`; or (2) [download](https://golang.org/doc/install#tarball).
2017-07-25 12:00:41 -04:00
2. See items (2-3) under **Binary Downloads**, above, for optional installations.
2017-07-14 18:29:56 -04:00
2017-07-06 18:18:32 -04:00
First-time install:
2017-07-14 18:29:56 -04:00
```bash
go get github.com/osteele/gojekyll
```
2017-07-06 18:18:32 -04:00
2017-07-14 18:29:56 -04:00
[Later] Update to the latest version:
2017-07-06 18:18:32 -04:00
2017-07-14 18:29:56 -04:00
```bash
go get -u github.com/osteele/liquid github.com/osteele/gojekyll
```
2017-07-01 20:35:05 -04:00
[Optional] Install command-line autocompletion:
```bash
# Bash:
eval "$(gojekyll --completion-script-bash)"
# Zsh:
eval "$(gojekyll --completion-script-zsh)"
```
2017-07-09 13:41:19 -04:00
## Status
2017-07-09 14:31:47 -04:00
This project is at an early stage of development.
2017-07-09 13:41:19 -04:00
2017-07-14 12:12:25 -04:00
It works on the GitHub Pages sites that I care about, and it looks credible on a spot-check of other Jekyll sites.
2017-07-09 13:41:19 -04:00
### Current Limitations
2017-07-01 20:24:11 -04:00
2017-07-07 15:48:31 -04:00
Missing features:
2017-07-09 14:05:46 -04:00
2017-07-05 19:23:15 -04:00
- Pagination
- Math
2017-07-25 12:00:41 -04:00
- Plugin system. ([Some individual plugins](./docs/plugins.md) are emulated.)
2017-07-15 10:59:55 -04:00
- Liquid filter `sassify`
2017-07-14 18:29:56 -04:00
- Markdown features: [attribute lists](https://kramdown.gettalong.org/syntax.html#attribute-list-definitions), [`markdown=1`](https://kramdown.gettalong.org/syntax.html#html-blocks).
2017-07-09 15:07:14 -04:00
- `site.data` is not sorted.
2017-07-09 14:05:46 -04:00
- Windows compatibility
2017-07-05 19:23:15 -04:00
2017-07-09 13:41:19 -04:00
Also see the [detailed status](#feature-status) below.
2017-07-05 19:23:15 -04:00
2017-07-09 13:41:19 -04:00
### Other Differences
2017-07-01 13:34:32 -04:00
2017-07-09 13:41:19 -04:00
These will probably not change:
2017-07-02 09:29:13 -04:00
2017-07-09 18:48:49 -04:00
By design:
2017-07-10 14:33:06 -04:00
- Plugins must be listed in the config file, not a Gemfile.
2017-07-26 08:01:24 -04:00
- Liquid is run in strict mode; undefined filters are errors.
2017-07-16 11:31:36 -04:00
- The wrong type in a `_config.yml` is an error.
2017-07-14 18:29:56 -04:00
- Server live reload is always on.
- `serve --watch` (the default) reloads the `_config.yml` and data files too.
2017-07-16 11:31:36 -04:00
- `serve` generates pages on the fly; it doesn't write to the file system.
2017-07-17 11:48:30 -04:00
- Files are cached in `/tmp/gojekyll-${USER}`, not `./.sass-cache`
2017-07-09 18:48:49 -04:00
- Jekyll provides an (undocumented) `jekyll.version` variable to templates. Copying this didn't seem right.
2017-07-05 17:02:58 -04:00
2017-07-09 18:48:49 -04:00
Muzukashii:
2017-07-01 20:24:11 -04:00
2017-07-09 18:48:49 -04:00
- An extensible plugin mechanism support for plugins that aren't compiled into the executable.
2017-07-01 20:24:11 -04:00
2017-07-09 18:48:49 -04:00
### Feature Checklist
2017-06-18 19:12:33 -04:00
- [ ] Content
- [x] Front Matter
2017-07-09 18:48:49 -04:00
- [x] Posts
2017-06-18 19:12:33 -04:00
- [x] Static Files
- [x] Variables
2017-06-22 08:34:37 -04:00
- [x] Collections
2017-07-14 18:29:56 -04:00
- [x] Data Files
2017-06-18 19:12:33 -04:00
- [ ] Assets
- [ ] Coffeescript
2017-06-18 22:24:10 -04:00
- [x] Sass/SCSS
2017-06-18 19:12:33 -04:00
- [ ] Customization
- [x] Templates
2017-06-29 09:41:33 -04:00
- [ ] Jekyll filters
2017-07-10 17:16:53 -04:00
- [ ] `group_by_exp` and `scssify`
2017-06-29 09:41:33 -04:00
- [x] everything else
2017-07-04 17:13:47 -04:00
- [x] Jekyll tags
2017-06-18 19:12:33 -04:00
- [x] Includes
- [x] Permalinks
- [ ] Pagination
2017-07-14 18:29:56 -04:00
- [ ] Plugins partial; see [here](./docs/plugins.md)
2017-07-24 09:32:57 -04:00
- [x] Themes
2017-06-18 19:12:33 -04:00
- [x] Layouts
- [x] Server
- [x] Directory watch
2017-07-01 13:34:32 -04:00
- [ ] Commands
- [x] `build`
2017-07-25 09:29:38 -04:00
- [x] `--source`, `--destination`, `--drafts`, `--future`, `--unpublished`
- [x] `--incremental`, `--watch`, `--force_polling`
2017-07-25 12:00:41 -04:00
- [ ] `--baseurl`, `--config`, `--lsi`, `JEKYLL_ENV=production`
- [ ] `--limit-posts`
2017-07-01 13:34:32 -04:00
- [x] `clean`
- [x] `help`
- [x] `serve`
2017-07-25 09:29:38 -04:00
- [x] `--open-uri`, `--host`, `--port`
- [x] `--incremental`, `watch`, `--force_polling`
- [ ] `--baseurl`, `--config`
2017-07-14 18:29:56 -04:00
- [ ] `--detach`, `--ssl`-* not planned
- [ ] `doctor`, `import`, `new`, `new-theme` not planned
2017-07-09 18:48:49 -04:00
- [ ] Windows
2017-06-23 10:27:57 -04:00
## Contributing
2017-06-20 09:00:04 -04:00
2017-07-14 18:29:56 -04:00
Bug reports, test cases, and code contributions are [more than welcome](./CONTRIBUTING.md).
2017-06-11 18:59:02 -04:00
2017-07-09 15:21:11 -04:00
## Attribution
2017-06-11 18:59:02 -04:00
2017-06-29 07:08:37 -04:00
Gojekyll uses these libraries:
2017-06-20 09:00:04 -04:00
2017-07-25 12:00:41 -04:00
| Package | Author(s) | Usage | License |
|--------------------------------------------------------------------------------|--------------------------------------------------------|----------------------------------------|-----------------------------------------|
| [github.com/jaschaephraim/lrserver](https://github.com/jaschaephraim/lrserver) | Jascha Ephraim | Live Reload | MIT License |
| [github.com/kyokomi/emoji](https://github.com/kyokomi/emoji) | kyokomi | `jemoji` plugin emulation | MIT License |
| [github.com/osteele/liquid](https://github.com/osteele/liquid) | yours truly | Liquid processor | MIT License |
| [github.com/pkg/browser](https://github.com/pkg/browser) | [pkg](https://github.com/pkg) | `serve --open-url` option | BSD 2-clause "Simplified" License |
| [github.com/radovskyb/watcher](https://github.com/radovskyb/watcher) | Benjamin Radovsky | Polling file watch (`--force_polling`) | BSD 3-clause "New" or "Revised" License |
2017-07-25 12:00:41 -04:00
| [github.com/russross/blackfriday](https://github.com/russross/blackfriday) | Russ Ross | Markdown processing | Simplified BSD License |
| [github.com/sass/libsass](https://github.com/sass/libsass) | Listed [here](https://https://github.com/sass/libsass) | C port of the Ruby SASS compiler | MIT License |
| [github.com/tdewolff/minify](https://github.com/tdewolff/minify) | Taco de Wolff | CSS minimization | MIT License |
2017-07-25 12:00:41 -04:00
| [github.com/wellington/go-libsass](https://github.com/wellington/go-libsass) | Drew Wells | Go bindings for **libsass** | ??? |
| [gopkg.in/alecthomas/kingpin.v2](https://github.com/alecthomas/kingpin) | Alec Thomas | command-line arguments | MIT License |
| [gopkg.in/yaml.v2](https://github.com/go-yaml/yaml) | Canonical | YAML support | Apache License 2.0 |
2017-06-29 07:08:37 -04:00
2017-07-09 13:41:19 -04:00
In addition, the following pieces of text were taken from Jekyll and its plugins.
They are used under the terms of the MIT License.
2017-07-09 15:07:14 -04:00
| Source | Use | Description |
2017-07-09 13:41:19 -04:00
|---------------------------------------------------------------------------------|----------------------|------------------------|
| [Jekyll template documentation](https://jekyllrb.com/docs/templates/) | test cases | filter examples |
2017-07-25 12:00:41 -04:00
| `jekyll help` command | `gojekyll help` text | help text |
2017-07-09 13:41:19 -04:00
| [`jekyll-feed` plugin](https://github.com/jekyll/jekyll-feed) | plugin emulation | `feed.xml` template |
| [`jekyll-redirect-from` plugin](https://github.com/jekyll/jekyll-redirect-from) | plugin emulation | redirect page template |
2017-07-12 19:15:55 -04:00
| [`jekyll-sitemap` plugin](https://github.com/jekyll/jekyll-redirect-from) | plugin emulation | sitemap template |
| [`jekyll-seo-tag` plugin](https://github.com/jekyll/jekyll-redirect-from) | plugin emulation | feed template |
2017-07-08 19:57:41 -04:00
2017-07-17 11:48:30 -04:00
The theme for in-browser error reporting was adapted from facebookincubator/create-react-app.
2017-07-01 23:06:47 -04:00
The gopher image in the `testdata` directory is from [Wikimedia Commons](https://commons.wikimedia.org/wiki/File:Gophercolor.jpg). It is used under the [Creative Commons Attribution-Share Alike 3.0 Unported license](https://creativecommons.org/licenses/by-sa/3.0/deed.en).
2017-06-11 21:05:17 -04:00
2017-07-09 13:41:19 -04:00
In addition to being totally and obviously inspired by Jekyll and its plugins, Jekyll's solid *documentation* was indispensible --- especially since I wanted to implement Jekyll as documented, not port its source code. The [Jekyll docs](https://jekyllrb.com/docs/home/) were always open in at least one tab during development.
2017-07-08 21:41:35 -04:00
2017-06-11 18:59:02 -04:00
## Related
2017-07-14 18:29:56 -04:00
[Hugo](https://gohugo.io) is the pre-eminent Go static site generator. It isn't Jekyll-compatible (-), but it's highly polished, performant, and productized (+++).
2017-07-09 13:41:19 -04:00
2017-07-14 18:29:56 -04:00
[jkl](https://github.com/drone/jkl) is another Go clone of Jekyll. If I'd found it sooner I might have started this project by forking that one. It's got a better name.
2017-06-11 18:59:02 -04:00
2017-07-09 13:41:19 -04:00
[Liquid](https://github.com/osteele/liquid) is a pure Go implementation of Liquid templates, that I finally caved and wrote in order to use in this project.
2017-07-01 20:24:11 -04:00
2017-06-11 20:30:25 -04:00
[Jekyll](https://jekyllrb.com), of course.
2017-06-11 18:59:02 -04:00
## License
MIT
2017-07-06 18:18:32 -04:00
[coveralls-url]: https://coveralls.io/r/osteele/gojekyll
[coveralls-svg]: https://img.shields.io/coveralls/osteele/gojekyll.svg?branch=master
[license-url]: https://github.com/osteele/gojekyll/blob/master/LICENSE
[license-svg]: https://img.shields.io/badge/license-MIT-blue.svg
[go-report-card-url]: https://goreportcard.com/report/github.com/osteele/gojekyll
[go-report-card-svg]: https://goreportcard.com/badge/github.com/osteele/gojekyll
[travis-url]: https://travis-ci.org/osteele/gojekyll
[travis-svg]: https://img.shields.io/travis/osteele/gojekyll.svg?branch=master