1
0
mirror of https://github.com/danog/gojekyll.git synced 2024-11-30 07:38:59 +01:00
gojekyll/README.md

205 lines
9.4 KiB
Markdown
Raw Normal View History

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-07-09 01:57:41 +02:00
Gojekyll is a clone of the [Jekyll](https://jekyllrb.com) static site generator, in the [Go](https://golang.org) programming language.
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-07 21:48:31 +02:00
- [Current Limitations](#current-limitations)
2017-07-02 15:29:13 +02:00
- [Other Differences](#other-differences)
- [Timings](#timings)
2017-07-05 17:18:00 +02:00
- [Feature Status](#feature-status)
2017-07-02 02:24:11 +02:00
- [Contributing](#contributing)
- [Credits](#credits)
- [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-02 02:35:05 +02:00
1. [Install go](https://golang.org/doc/install#install). On macOS running Homebrew, `brew install go` is easier than the linked instructions.
2017-07-07 00:18:32 +02:00
2. `go get osteele/gojekyll/cmd/gojekyll`
3. To use the `{% highlight %}` tag, you need Pygments. `pip install Pygments`.
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-07 21:28:51 +02:00
gojekyll serve # serve the app at http://localhost:4000
2017-07-02 02:35:05 +02:00
gojekyll help
gojekyll help build
```
2017-07-07 21:48:31 +02:00
## Current Limitations
2017-07-02 02:24:11 +02:00
2017-07-07 21:48:31 +02:00
Missing features:
2017-07-06 01:23:15 +02:00
- Themes
- Excerpts
- Pagination
- Math
2017-07-07 15:36:10 +02:00
- Plugins (except `jekyll-avatar` and `jekyll-gist`)
2017-07-07 21:48:31 +02:00
- `site-static_files`, `site.html_files`, and `site.tags`
- CSV and JSON data files
- Jekyll liquid filters: `group_by_exp`, `cgi_escape`, `uri_escape`, `scssify`, and `smartify`
2017-07-06 01:23:15 +02:00
2017-07-07 15:36:10 +02:00
For more detailed status:
2017-07-06 01:23:15 +02:00
2017-07-07 21:48:31 +02:00
- 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-07-01 19:34:32 +02:00
2017-07-02 15:29:13 +02:00
## Other Differences
These will probably not change.
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-07 21:48:31 +02:00
- The server reloads the `_config.yml` too.
- An extensible plugin mechanism: support for plugins that aren't compiled into the executable.
- Incremental build isn't planned. The emphasis is on optimizing the non-incremental case.
2017-07-01 19:34:32 +02:00
2017-07-02 15:29:13 +02:00
## Timings
2017-07-02 02:24:11 +02:00
2017-07-02 15:29:13 +02:00
`[go]jekyll -s jekyll/docs build` on a late-2015 MacBook Pro, running current versions of everything as of 2017-07-01.
2017-07-02 02:24:11 +02:00
2017-07-07 21:48:31 +02:00
| Executable | Options | Time |
|------------|-----------------------------|---------------|
| jekyll | | 18.53s |
| gojekyll | single-threaded; cold cache | 3.31s ± 0.07s |
| gojekyll | single-threaded; warm cache | 2.50s ± 0.04s |
| gojekyll | multi-threaded | 1.51s ± 0.01s |
| gojekyll | multi-threaded | 0.80s ± 0.09s |
2017-07-02 02:24:11 +02:00
2017-07-07 21:48:31 +02:00
This isn't an apples-to-ranges comparison. Gojekyll doesn't use all the plugins that Jekyll does. In particular, `jekyll-mentions` parses each page's HTML. This could slow Gojekyll down once it's added.
2017-07-05 23:02:58 +02:00
2017-07-07 21:48:31 +02:00
There's currently no way to disable the cache. It was disabled off by re-building the executable.
2017-07-02 02:24:11 +02:00
2017-07-02 15:29:13 +02:00
The cache is for calls to Pygments (via the `highlight` tag). For another site, SASS is greater overhead. This is another candidate for caching, but with multi-threading it may not matter.
2017-07-02 02:24:11 +02:00
2017-07-05 17:18:00 +02:00
## Feature Status
2017-06-19 01:12:33 +02:00
- [ ] Content
- [x] Front Matter
- [ ] Posts
2017-07-01 15:35:26 +02:00
- [x] Categories
2017-06-19 01:12:33 +02:00
- [ ] 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-01 04:38:27 +02:00
- [ ] `group_by_exp` `pop` `shift` `cgi_escape` `uri_escape` `scssify` `smartify`
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-02 01:42:48 +02:00
- [ ] `--config`, `--baseurl`, `--lsi`, `--watch`, etc.
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`
- [ ] `doctor`
- [x] `help`
- [ ] `import`
- [ ] `new`
- [ ] `new-theme`
- [x] `serve`
- [x] `--open-uri`
2017-07-02 01:42:48 +02:00
- [ ] `--detach`, `--host`, `--port`, `--baseurl`
2017-07-04 23:13:47 +02:00
- [ ] not planned: `--incremental`, `--ssl`-*
2017-06-29 15:41:33 +02:00
- [ ] Windows
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
## Credits
2017-06-29 13:08:37 +02:00
Gojekyll uses these libraries:
2017-06-20 15:00:04 +02:00
2017-07-02 02:24:11 +02:00
| Package | Author(s) | Description | License |
|--------------------------------------------------------------------------------|--------------------------------------------------------|-------------------------------------------------------|-----------------------------------|
| [github.com/jaschaephraim/lrserver](https://github.com/jaschaephraim/lrserver) | Jascha Ephraim | Live Reload server | MIT |
| [github.com/osteele/liquid](https://github.com/osteele/liquid) | yours truly | Liquid processor | MIT |
| [github.com/pkg/browser](https://github.com/pkg/browser) | [pkg](https://github.com/pkg) | The `serve -o` option to open the site in the browser | BSD 2-clause "Simplified" License |
| [github.com/russross/blackfriday](https://github.com/russross/blackfriday) | Russ Ross | Markdown processor | 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 |
| [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 and flag parser | MIT |
| [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-02 05:06:47 +02:00
In addition to being totally and obviously inspired by Jekyll, Jekyll's *documentation* was solid and indispensible. Many of the filter test cases are taken directly from the Jekyll documentation, and during development the [Jekyll docs](https://jekyllrb.com/docs/home/) were always open in at least one tab.
2017-06-22 01:19:08 +02:00
2017-07-02 05:06:47 +02:00
The text for `gojekyll help` was taken from the output of `jekyll help`.
2017-07-01 20:55:50 +02:00
2017-07-09 01:57:41 +02:00
The template for page redirections was adapted from the template in <https://github.com/jekyll/jekyll-redirect-from>.
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-06-12 00:59:02 +02:00
## Related
2017-07-02 05:06:47 +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 (+++).
2017-06-12 00:59:02 +02:00
2017-07-02 05:06:47 +02:00
[Liquid](https://github.com/osteele/liquid) is a Go implementation of Liquid templates. I wrote it for gojekyll, but it's implemented as a standalone library.
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