2017-07-01 19:34:32 +02:00
# Gojekyll
2017-07-02 05:54:12 +02:00
2017-07-07 00:18:32 +02:00
[![][travis-svg]][travis-url] [![][coveralls-svg]][coveralls-url] [![][go-report-card-svg]][go-report-card-url] [![][license-svg]][license-url]
2017-06-10 21:38:09 +02:00
2017-07-11 23:17:23 +02:00
> “It is easier to write an incorrect program than understand a correct one.” - Alan Perlis
2017-07-10 00:48:49 +02:00
2017-07-11 23:54:25 +02:00
Gojekyll is a 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 for the latter.
2017-07-10 00:48:49 +02:00
2017-07-12 15:52:40 +02:00
| | Gojekyll | Jekyll | Hugo |
|----------------------|--------------------------------------|--------|--------------|
| Fast | ✓ [~20× Jekyll ](./docs/benchmarks.md ) | | ✓ |
| Stable | | ✓ | ✓ |
| Template language | Liquid | Liquid | Go templates |
| Jekyll compatibility | [partial ](#current-limitations ) | ✓ | |
| Plugins | [some ](./docs/plugins.md ) | yes | ? |
| Windows | | ✓ | ✓ |
| Implementation | Go | Ruby | Go |
2017-07-11 23:44:17 +02:00
2017-07-01 19:34:32 +02:00
2017-07-02 02:24:11 +02:00
<!-- TOC -->
2017-07-01 19:34:32 +02:00
2017-07-02 02:24:11 +02:00
- [Gojekyll ](#gojekyll )
- [Installation ](#installation )
- [Usage ](#usage )
2017-07-09 19:41:19 +02:00
- [Status ](#status )
- [Current Limitations ](#current-limitations )
- [Other Differences ](#other-differences )
2017-07-10 00:48:49 +02:00
- [Feature Checklist ](#feature-checklist )
2017-07-02 02:24:11 +02:00
- [Contributing ](#contributing )
2017-07-09 21:21:11 +02:00
- [Attribution ](#attribution )
2017-07-02 02:24:11 +02:00
- [Related ](#related )
- [License ](#license )
<!-- /TOC -->
2017-07-02 02:35:05 +02:00
## Installation
2017-07-07 00:18:32 +02:00
First-time install:
2017-07-09 17:57:20 +02:00
1. [Install go ](https://golang.org/doc/install#install ). (On macOS running [Homebrew ](https://brew.sh ), `brew install go` is easier than the Install instructions on the Go site.)
2017-07-07 00:18:32 +02:00
2. `go get osteele/gojekyll/cmd/gojekyll`
2017-07-10 00:48:49 +02:00
3. To use the `{% highlight %}` tag, you also need [Pygments ](http://pygments.org ). `pip install Pygments` .
2017-07-07 00:18:32 +02:00
Update to the latest version:
* `go get -u github.com/osteele/liquid github.com/osteele/gojekyll/cmd/gojekyll`
2017-07-02 02:35:05 +02:00
## Usage
```bash
2017-07-06 01:23:15 +02:00
gojekyll build # builds the site in the current directory into _site
2017-07-09 17:57:20 +02:00
gojekyll serve # serve the app at http://localhost:4000; reload on changes
2017-07-02 02:35:05 +02:00
gojekyll help
gojekyll help build
```
2017-07-09 19:41:19 +02:00
## Status
2017-07-09 20:31:47 +02:00
This project is at an early stage of development.
2017-07-09 19:41:19 +02:00
It works on the Google Pages sites that I care about, and it looks credible on a spot-check of other Jekyll sites.
It doesn't run on Windows, and it may not work for you.
2017-07-10 00:48:49 +02:00
In addition to the limitations listed below, this software isn't robust. Jekyll, Hugo, and other mature projects have lots of test coverage, and have had lots of testing by lots of people. I've this used only in limited ways, in the month since I started writing it.
2017-07-09 19:41:19 +02:00
### Current Limitations
2017-07-02 02:24:11 +02:00
2017-07-07 21:48:31 +02:00
Missing features:
2017-07-09 20:05:46 +02:00
2017-07-06 01:23:15 +02:00
- Themes
- Excerpts
- Pagination
- Math
2017-07-07 21:48:31 +02:00
- CSV and JSON data files
2017-07-11 23:54:25 +02:00
- Plugins. (Some plugins are [emulated ](./docs/plugins.md ).)
2017-07-10 23:16:53 +02:00
- Template filters `group_by_exp` and `scssify`
2017-07-09 19:41:19 +02:00
- More Liquid tags and filters, listed [here ](https://github.com/osteele/liquid#differences-from-liquid ).
- Markdown features: [attribute lists ](https://kramdown.gettalong.org/syntax.html#attribute-list-definitions ), [automatic ids ](https://kramdown.gettalong.org/converter/html.html#auto-ids ), [`markdown=1` ](https://kramdown.gettalong.org/syntax.html#html-blocks ).
2017-07-09 21:07:14 +02:00
- `site.data` is not sorted.
2017-07-09 20:05:46 +02:00
- Windows compatibility
2017-07-06 01:23:15 +02:00
2017-07-09 19:41:19 +02:00
Also see the [detailed status ](#feature-status ) below.
2017-07-06 01:23:15 +02:00
2017-07-09 19:41:19 +02:00
### Other Differences
2017-07-01 19:34:32 +02:00
2017-07-09 19:41:19 +02:00
These will probably not change:
2017-07-02 15:29:13 +02:00
2017-07-10 00:48:49 +02:00
By design:
2017-07-10 20:33:06 +02:00
- Having the wrong type in a `_config.yml` is an error.
- Plugins must be listed in the config file, not a Gemfile.
2017-07-01 19:34:32 +02:00
- `serve` generates pages on the fly; it doesn't write to the file system.
2017-07-02 00:11:35 +02:00
- Files are cached to `/tmp/gojekyll-${USER}` , not `./.sass-cache`
2017-07-01 19:34:32 +02:00
- Server live reload is always on.
2017-07-09 19:41:19 +02:00
- `serve --watch` (the default) reloads `_config.yml` too.
2017-07-10 00:48:49 +02:00
- Jekyll provides an (undocumented) `jekyll.version` variable to templates. Copying this didn't seem right.
- Incremental build. The emphasis is on optimizing the non-incremental case. This is easier with fewer code paths.
2017-07-05 23:02:58 +02:00
2017-07-10 00:48:49 +02:00
Muzukashii:
2017-07-02 02:24:11 +02:00
2017-07-10 00:48:49 +02:00
- An extensible plugin mechanism – support for plugins that aren't compiled into the executable.
2017-07-02 02:24:11 +02:00
2017-07-10 00:48:49 +02:00
### Feature Checklist
2017-06-19 01:12:33 +02:00
- [ ] Content
- [x] Front Matter
2017-07-10 00:48:49 +02:00
- [x] Posts
2017-07-01 15:35:26 +02:00
- [x] Categories
2017-07-10 00:48:49 +02:00
- [x] Tags
2017-07-01 23:46:18 +02:00
- [x] Drafts
- [x] Future
2017-07-01 04:05:55 +02:00
- [x] Related
2017-06-19 01:12:33 +02:00
- [x] Static Files
- [x] Variables
2017-06-22 14:34:37 +02:00
- [x] Collections
2017-06-19 01:12:33 +02:00
- [ ] Data Files
2017-06-19 20:44:34 +02:00
- [ ] CSV
- [ ] JSON
- [x] YAML
2017-06-19 01:12:33 +02:00
- [ ] Assets
- [ ] Coffeescript
2017-06-19 04:24:10 +02:00
- [x] Sass/SCSS
2017-06-19 01:12:33 +02:00
- [ ] Customization
- [x] Templates
2017-06-29 15:41:33 +02:00
- [ ] Jekyll filters
2017-07-10 23:16:53 +02:00
- [ ] `group_by_exp` and `scssify`
2017-06-29 15:41:33 +02:00
- [x] everything else
2017-07-04 23:13:47 +02:00
- [x] Jekyll tags
2017-06-29 15:41:33 +02:00
- [x] `include`
2017-07-04 23:13:47 +02:00
- [x] `include_relative`
2017-06-29 15:41:33 +02:00
- [x] `link`
2017-07-01 23:46:18 +02:00
- [x] `post_url`
- [x] `highlight`
2017-06-19 01:12:33 +02:00
- [x] Includes
2017-06-29 15:41:33 +02:00
- [x] `include` parameters
2017-07-01 23:46:18 +02:00
- [x] `include` variables (e.g. `{% include {{ expr }} %}` )
2017-06-19 01:12:33 +02:00
- [x] Permalinks
- [ ] Pagination
2017-07-01 19:34:32 +02:00
- [ ] Plugins
- [x] `jekyll-avatar`
- [ ] `jekyll-coffeescript`
2017-07-02 05:06:47 +02:00
- [x] `jekyll-gist` (ignores `noscript: false` )
2017-07-01 19:34:32 +02:00
- [x] `jekyll-live-reload` (always on)
- [ ] `jekyll-paginate`
2017-06-19 01:12:33 +02:00
- [ ] Themes
- [x] Layouts
- [x] Server
- [x] Directory watch
2017-07-01 19:34:32 +02:00
- [ ] Commands
- [x] `build`
2017-07-01 21:13:32 +02:00
- [x] `--source` , `--destination` , `--drafts` , `--future` , `--unpublished`
2017-07-09 07:22:32 +02:00
- [ ] `--config` , `--baseurl` , `--lsi` , `--no-watch`
2017-07-04 23:13:47 +02:00
- [ ] not planned: `--force-polling` , `--limit-posts` , `--incremental` , `JEKYLL_ENV=production`
2017-07-01 19:34:32 +02:00
- [x] `clean`
- [x] `help`
- [x] `serve`
2017-07-09 07:22:32 +02:00
- [x] `--open-uri` , `--host` , `--port`
- [ ] `--detach` , `--baseurl`
2017-07-04 23:13:47 +02:00
- [ ] not planned: `--incremental` , `--ssl` -*
2017-07-09 07:22:32 +02:00
- [ ] not planned: `doctor` , `import` , `new` , `new-theme`
2017-07-10 00:48:49 +02:00
- [ ] Windows
2017-06-10 21:38:09 +02:00
2017-07-09 19:41:19 +02:00
Also see:
- The [feature parity board ](https://github.com/osteele/gojekyll/projects/1 ) board lists differences between Jekyll and gojekyll in more detail.
- The [plugin board ](https://github.com/osteele/gojekyll/projects/2 ) lists the implementation status of common plugins. (Gojekyll lacks an extensible plugin mechanism. The goal is to be able to use it to build Jekyll sites that use the most popular plugins.)
- The [Go Liquid feature parity board ](https://github.com/osteele/liquid/projects/1 ) to see differences between the real Liquid library and the one that is used in gojekyll.
2017-06-23 16:27:57 +02:00
## Contributing
2017-06-20 15:00:04 +02:00
2017-07-05 17:18:00 +02:00
Bug reports, test cases, and code contributions are more than welcome.
Please refer to the [contribution guidelines ](./CONTRIBUTING.md ).
2017-06-12 00:59:02 +02:00
2017-07-09 21:21:11 +02:00
## Attribution
2017-06-12 00:59:02 +02:00
2017-06-29 13:08:37 +02:00
Gojekyll uses these libraries:
2017-06-20 15:00:04 +02:00
2017-07-09 21:21:11 +02:00
| Package | Author(s) | Usage | License |
|--------------------------------------------------------------------------------|--------------------------------------------------------|----------------------------------|-----------------------------------------|
| [github.com/jaschaephraim/lrserver ](https://github.com/jaschaephraim/lrserver ) | Jascha Ephraim | Live Reload | MIT License |
| [github.com/dchest/cssmin ](https://github.com/dchest/cssmin ) | Dmitry Chestnykh | CSS minimization | BSD 3-clause "New" or "Revised" 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/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/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 13:08:37 +02:00
2017-07-09 19:41:19 +02: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 07:22:32 +02:00
2017-07-09 21:07:14 +02:00
| Source | Use | Description |
2017-07-09 19:41:19 +02:00
|---------------------------------------------------------------------------------|----------------------|------------------------|
| `jekyll help` command | `gojekyll help` text | help text |
| [Jekyll template documentation ](https://jekyllrb.com/docs/templates/ ) | test cases | filter examples |
| [`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-09 01:57:41 +02:00
2017-07-02 05:06:47 +02: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-12 03:05:17 +02:00
2017-07-09 19:41:19 +02: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-09 03:41:35 +02:00
2017-06-12 00:59:02 +02:00
## Related
2017-07-09 19:41:19 +02:00
[Hugo ](https://gohugo.io ) is the pre-eminent Go static site generator. It isn't Jekyll-compatible (-), but it's extraordinarily polished, performant, and productized (+++).
[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, too.
2017-06-12 00:59:02 +02:00
2017-07-09 19:41:19 +02: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-02 02:24:11 +02:00
2017-06-12 02:30:25 +02:00
[Jekyll ](https://jekyllrb.com ), of course.
2017-06-12 00:59:02 +02:00
## License
MIT
2017-07-07 00:18:32 +02: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