jekyll-docs 2.5.3 → 3.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/jekyll-docs.rb +34 -4
- data/site/CNAME +1 -0
- data/site/README.md +16 -0
- data/site/_config.yml +21 -0
- data/site/_data/docs.yml +47 -0
- data/site/_docs/assets.md +93 -0
- data/site/_docs/collections.md +380 -0
- data/site/_docs/configuration.md +677 -0
- data/site/_docs/continuous-integration.md +221 -0
- data/site/_docs/contributing.md +124 -0
- data/site/_docs/datafiles.md +151 -0
- data/site/_docs/deployment-methods.md +192 -0
- data/site/_docs/drafts.md +20 -0
- data/site/_docs/extras.md +22 -0
- data/site/_docs/frontmatter.md +191 -0
- data/site/_docs/github-pages.md +134 -0
- data/site/_docs/history.md +2131 -0
- data/site/_docs/index.md +56 -0
- data/site/_docs/installation.md +106 -0
- data/site/_docs/migrations.md +9 -0
- data/site/_docs/pages.md +84 -0
- data/site/_docs/pagination.md +221 -0
- data/site/_docs/permalinks.md +307 -0
- data/site/_docs/plugins.md +891 -0
- data/site/_docs/posts.md +237 -0
- data/site/_docs/quickstart.md +27 -0
- data/site/_docs/resources.md +46 -0
- data/site/_docs/sites.md +29 -0
- data/site/_docs/static_files.md +52 -0
- data/site/_docs/structure.md +211 -0
- data/site/_docs/templates.md +425 -0
- data/site/_docs/troubleshooting.md +207 -0
- data/site/_docs/upgrading.md +140 -0
- data/site/_docs/usage.md +101 -0
- data/site/_docs/variables.md +390 -0
- data/site/_docs/windows.md +44 -0
- data/site/_includes/analytics.html +30 -0
- data/site/_includes/anchor_links.html +33 -0
- data/site/_includes/docs_contents.html +8 -0
- data/site/_includes/docs_contents_mobile.html +10 -0
- data/site/_includes/docs_option.html +11 -0
- data/site/_includes/docs_ul.html +21 -0
- data/site/_includes/footer.html +15 -0
- data/site/_includes/header.html +18 -0
- data/site/_includes/news_contents.html +33 -0
- data/site/_includes/news_contents_mobile.html +11 -0
- data/site/_includes/news_item.html +24 -0
- data/site/_includes/primary-nav-items.html +17 -0
- data/site/_includes/section_nav.html +39 -0
- data/site/_includes/top.html +17 -0
- data/site/_layouts/default.html +13 -0
- data/site/_layouts/docs.html +26 -0
- data/site/_layouts/news.html +19 -0
- data/site/_layouts/news_item.html +27 -0
- data/site/_layouts/page.html +18 -0
- data/site/_posts/2013-05-06-jekyll-1-0-0-released.markdown +23 -0
- data/site/_posts/2013-05-08-jekyll-1-0-1-released.markdown +27 -0
- data/site/_posts/2013-05-12-jekyll-1-0-2-released.markdown +28 -0
- data/site/_posts/2013-06-07-jekyll-1-0-3-released.markdown +25 -0
- data/site/_posts/2013-07-14-jekyll-1-1-0-released.markdown +27 -0
- data/site/_posts/2013-07-24-jekyll-1-1-1-released.markdown +31 -0
- data/site/_posts/2013-07-25-jekyll-1-0-4-released.markdown +20 -0
- data/site/_posts/2013-07-25-jekyll-1-1-2-released.markdown +20 -0
- data/site/_posts/2013-09-06-jekyll-1-2-0-released.markdown +23 -0
- data/site/_posts/2013-09-14-jekyll-1-2-1-released.markdown +19 -0
- data/site/_posts/2013-10-28-jekyll-1-3-0-rc1-released.markdown +17 -0
- data/site/_posts/2013-11-04-jekyll-1-3-0-released.markdown +43 -0
- data/site/_posts/2013-11-26-jekyll-1-3-1-released.markdown +21 -0
- data/site/_posts/2013-12-07-jekyll-1-4-0-released.markdown +30 -0
- data/site/_posts/2013-12-09-jekyll-1-4-1-released.markdown +18 -0
- data/site/_posts/2013-12-16-jekyll-1-4-2-released.markdown +18 -0
- data/site/_posts/2014-01-13-jekyll-1-4-3-released.markdown +26 -0
- data/site/_posts/2014-03-24-jekyll-1-5-0-released.markdown +19 -0
- data/site/_posts/2014-03-27-jekyll-1-5-1-released.markdown +26 -0
- data/site/_posts/2014-05-06-jekyll-turns-2-0-0.markdown +31 -0
- data/site/_posts/2014-05-08-jekyll-2-0-3-released.markdown +18 -0
- data/site/_posts/2014-06-04-jekyll-stickers-1-dollar-stickermule.markdown +19 -0
- data/site/_posts/2014-06-28-jekyll-turns-21-i-mean-2-1-0.markdown +31 -0
- data/site/_posts/2014-07-01-jekyll-2-1-1-released.markdown +30 -0
- data/site/_posts/2014-07-29-jekyll-2-2-0-released.markdown +19 -0
- data/site/_posts/2014-08-10-jekyll-2-3-0-released.markdown +41 -0
- data/site/_posts/2014-09-09-jekyll-2-4-0-released.markdown +25 -0
- data/site/_posts/2014-11-06-jekylls-midlife-crisis-jekyll-turns-2-5-0.markdown +47 -0
- data/site/_posts/2014-11-08-jekyll-2-5-1-released.markdown +29 -0
- data/site/_posts/2014-11-12-jekyll-2-5-2-released.markdown +18 -0
- data/site/_posts/2014-12-17-alfredxing-welcome-to-jekyll-core.md +27 -0
- data/site/_posts/2014-12-22-jekyll-2-5-3-released.markdown +20 -0
- data/site/_posts/2015-01-20-jekyll-meet-and-greet.markdown +20 -0
- data/site/_posts/2015-01-24-jekyll-3-0-0-beta1-released.markdown +40 -0
- data/site/_posts/2015-02-26-introducing-jekyll-talk.markdown +15 -0
- data/site/_posts/2015-10-26-jekyll-3-0-released.markdown +35 -0
- data/site/_posts/2015-11-17-jekyll-3-0-1-released.markdown +25 -0
- data/site/_posts/2016-01-20-jekyll-3-0-2-released.markdown +14 -0
- data/site/_posts/2016-02-08-jekyll-3-0-3-released.markdown +31 -0
- data/site/_sass/_font-awesome.scss +25 -0
- data/site/_sass/_gridism.scss +124 -0
- data/site/_sass/_mixins.scss +38 -0
- data/site/_sass/_normalize.scss +1 -0
- data/site/_sass/_pygments.scss +78 -0
- data/site/_sass/_style.scss +998 -0
- data/site/css/screen.scss +9 -0
- data/site/favicon.ico +0 -0
- data/site/fonts/fontawesome-webfont.eot +0 -0
- data/site/fonts/fontawesome-webfont.svg +640 -0
- data/site/fonts/fontawesome-webfont.ttf +0 -0
- data/site/fonts/fontawesome-webfont.woff +0 -0
- data/site/fonts/fontawesome-webfont.woff2 +0 -0
- data/site/freenode.txt +1 -0
- data/site/help/index.md +36 -0
- data/site/img/article-footer.png +0 -0
- data/site/img/footer-arrow.png +0 -0
- data/site/img/footer-logo.png +0 -0
- data/site/img/jekyll-sticker.jpg +0 -0
- data/site/img/logo-2x.png +0 -0
- data/site/img/logo-rss.png +0 -0
- data/site/img/octojekyll.png +0 -0
- data/site/index.html +90 -0
- data/site/js/html5shiv.min.js +4 -0
- data/site/js/respond.min.js +5 -0
- data/site/latest_version.txt +1 -0
- data/site/news/index.html +10 -0
- data/site/news/releases/index.html +10 -0
- metadata +138 -6
- data/lib/jekyll-docs/version.rb +0 -5
- data/lib/jekyll/commands/docs.rb +0 -30
- data/lib/jekyll/docs.rb +0 -7
@@ -0,0 +1,221 @@
|
|
1
|
+
---
|
2
|
+
layout: docs
|
3
|
+
title: Continuous Integration
|
4
|
+
permalink: /docs/continuous-integration/
|
5
|
+
---
|
6
|
+
|
7
|
+
You can easily test your website build against one or more versions of Ruby.
|
8
|
+
The following guide will show you how to set up a free build environment on
|
9
|
+
[Travis][0], with [GitHub][1] integration for pull requests. Paid
|
10
|
+
alternatives exist for private repositories.
|
11
|
+
|
12
|
+
[0]: https://travis-ci.org/
|
13
|
+
[1]: https://github.com/
|
14
|
+
|
15
|
+
## 1. Enabling Travis and GitHub
|
16
|
+
|
17
|
+
Enabling Travis builds for your GitHub repository is pretty simple:
|
18
|
+
|
19
|
+
1. Go to your profile on travis-ci.org: https://travis-ci.org/profile/username
|
20
|
+
2. Find the repository for which you're interested in enabling builds.
|
21
|
+
3. Click the slider on the right so it says "ON" and is a dark grey.
|
22
|
+
4. Optionally configure the build by clicking on the wrench icon. Further
|
23
|
+
configuration happens in your `.travis.yml` file. More details on that
|
24
|
+
below.
|
25
|
+
|
26
|
+
## 2. The Test Script
|
27
|
+
|
28
|
+
The simplest test script simply runs `jekyll build` and ensures that Jekyll
|
29
|
+
doesn't fail to build the site. It doesn't check the resulting site, but it
|
30
|
+
does ensure things are built properly.
|
31
|
+
|
32
|
+
When testing Jekyll output, there is no better tool than [html-proofer][2].
|
33
|
+
This tool checks your resulting site to ensure all links and images exist.
|
34
|
+
Utilize it either with the convenient `htmlproof` command-line executable,
|
35
|
+
or write a Ruby script which utilizes the gem.
|
36
|
+
|
37
|
+
Save the commands you want to run and succeed in a file: `./script/cibuild`
|
38
|
+
|
39
|
+
### The HTML Proofer Executable
|
40
|
+
|
41
|
+
{% highlight bash %}
|
42
|
+
#!/usr/bin/env bash
|
43
|
+
set -e # halt script on error
|
44
|
+
|
45
|
+
bundle exec jekyll build
|
46
|
+
bundle exec htmlproof ./_site
|
47
|
+
{% endhighlight %}
|
48
|
+
|
49
|
+
Some options can be specified via command-line switches. Check out the
|
50
|
+
`html-proofer` README for more information about these switches, or run
|
51
|
+
`htmlproof --help` locally.
|
52
|
+
|
53
|
+
For example to avoid testing external sites, use this command:
|
54
|
+
|
55
|
+
{% highlight bash %}
|
56
|
+
$ bundle exec htmlproof ./_site --disable-external
|
57
|
+
{% endhighlight %}
|
58
|
+
|
59
|
+
### The HTML Proofer Library
|
60
|
+
|
61
|
+
You can also invoke `html-proofer` in Ruby scripts (e.g. in a Rakefile):
|
62
|
+
|
63
|
+
{% highlight ruby %}
|
64
|
+
#!/usr/bin/env ruby
|
65
|
+
|
66
|
+
require 'html/proofer'
|
67
|
+
HTML::Proofer.new("./_site").run
|
68
|
+
{% endhighlight %}
|
69
|
+
|
70
|
+
Options are given as a second argument to `.new`, and are encoded in a
|
71
|
+
symbol-keyed Ruby Hash. For more information about the configuration options,
|
72
|
+
check out `html-proofer`'s README file.
|
73
|
+
|
74
|
+
[2]: https://github.com/gjtorikian/html-proofer
|
75
|
+
|
76
|
+
## 3. Configuring Your Travis Builds
|
77
|
+
|
78
|
+
This file is used to configure your Travis builds. Because Jekyll is built
|
79
|
+
with Ruby and requires RubyGems to install, we use the Ruby language build
|
80
|
+
environment. Below is a sample `.travis.yml` file, followed by
|
81
|
+
an explanation of each line.
|
82
|
+
|
83
|
+
**Note:** You will need a Gemfile as well, [Travis will automatically install](http://docs.travis-ci.com/user/languages/ruby/#Dependency-Management) the dependencies based on the referenced gems:
|
84
|
+
|
85
|
+
{% highlight ruby %}
|
86
|
+
source "https://rubygems.org"
|
87
|
+
|
88
|
+
gem "jekyll"
|
89
|
+
gem "html-proofer"
|
90
|
+
{% endhighlight %}
|
91
|
+
|
92
|
+
Your `.travis.yml` file should look like this:
|
93
|
+
|
94
|
+
{% highlight yaml %}
|
95
|
+
language: ruby
|
96
|
+
rvm:
|
97
|
+
- 2.1
|
98
|
+
|
99
|
+
before_script:
|
100
|
+
- chmod +x ./script/cibuild # or do this locally and commit
|
101
|
+
|
102
|
+
# Assume bundler is being used, therefore
|
103
|
+
# the `install` step will run `bundle install` by default.
|
104
|
+
script: ./script/cibuild
|
105
|
+
|
106
|
+
# branch whitelist, only for GitHub Pages
|
107
|
+
branches:
|
108
|
+
only:
|
109
|
+
- gh-pages # test the gh-pages branch
|
110
|
+
- /pages-(.*)/ # test every branch which starts with "pages-"
|
111
|
+
|
112
|
+
env:
|
113
|
+
global:
|
114
|
+
- NOKOGIRI_USE_SYSTEM_LIBRARIES=true # speeds up installation of html-proofer
|
115
|
+
{% endhighlight %}
|
116
|
+
|
117
|
+
Ok, now for an explanation of each line:
|
118
|
+
|
119
|
+
{% highlight yaml %}
|
120
|
+
language: ruby
|
121
|
+
{% endhighlight %}
|
122
|
+
|
123
|
+
This line tells Travis to use a Ruby build container. It gives your script
|
124
|
+
access to Bundler, RubyGems, and a Ruby runtime.
|
125
|
+
|
126
|
+
{% highlight yaml %}
|
127
|
+
rvm:
|
128
|
+
- 2.1
|
129
|
+
{% endhighlight %}
|
130
|
+
|
131
|
+
RVM is a popular Ruby Version Manager (like rbenv, chruby, etc). This
|
132
|
+
directive tells Travis the Ruby version to use when running your test
|
133
|
+
script.
|
134
|
+
|
135
|
+
{% highlight yaml %}
|
136
|
+
before_script:
|
137
|
+
- chmod +x ./script/cibuild
|
138
|
+
{% endhighlight %}
|
139
|
+
|
140
|
+
The build script file needs to have the *executable* attribute set or
|
141
|
+
Travis will fail with a permission denied error. You can also run this
|
142
|
+
locally and commit the permissions directly, thus rendering this step
|
143
|
+
irrelevant.
|
144
|
+
|
145
|
+
{% highlight yaml %}
|
146
|
+
script: ./script/cibuild
|
147
|
+
{% endhighlight %}
|
148
|
+
|
149
|
+
Travis allows you to run any arbitrary shell script to test your site. One
|
150
|
+
convention is to put all scripts for your project in the `script`
|
151
|
+
directory, and to call your test script `cibuild`. This line is completely
|
152
|
+
customizable. If your script won't change much, you can write your test
|
153
|
+
incantation here directly:
|
154
|
+
|
155
|
+
{% highlight yaml %}
|
156
|
+
install: gem install jekyll html-proofer
|
157
|
+
script: jekyll build && htmlproof ./_site
|
158
|
+
{% endhighlight %}
|
159
|
+
|
160
|
+
The `script` directive can be absolutely any valid shell command.
|
161
|
+
|
162
|
+
{% highlight yaml %}
|
163
|
+
# branch whitelist, only for GitHub Pages
|
164
|
+
branches:
|
165
|
+
only:
|
166
|
+
- gh-pages # test the gh-pages branch
|
167
|
+
- /pages-(.*)/ # test every branch which starts with "pages-"
|
168
|
+
{% endhighlight %}
|
169
|
+
|
170
|
+
You want to ensure the Travis builds for your site are being run only on
|
171
|
+
the branch or branches which contain your site. One means of ensuring this
|
172
|
+
isolation is including a branch whitelist in your Travis configuration
|
173
|
+
file. By specifying the `gh-pages` branch, you will ensure the associated
|
174
|
+
test script (discussed above) is only executed on site branches. If you use
|
175
|
+
a pull request flow for proposing changes, you may wish to enforce a
|
176
|
+
convention for your builds such that all branches containing edits are
|
177
|
+
prefixed, exemplified above with the `/pages-(.*)/` regular expression.
|
178
|
+
|
179
|
+
The `branches` directive is completely optional. Travis will build from every
|
180
|
+
push to any branch of your repo if leave it out.
|
181
|
+
|
182
|
+
{% highlight yaml %}
|
183
|
+
env:
|
184
|
+
global:
|
185
|
+
- NOKOGIRI_USE_SYSTEM_LIBRARIES=true # speeds up installation of html-proofer
|
186
|
+
{% endhighlight %}
|
187
|
+
|
188
|
+
Using `html-proofer`? You'll want this environment variable. Nokogiri, used
|
189
|
+
to parse HTML files in your compiled site, comes bundled with libraries
|
190
|
+
which it must compile each time it is installed. Luckily, you can
|
191
|
+
dramatically decrease the install time of Nokogiri by setting the
|
192
|
+
environment variable `NOKOGIRI_USE_SYSTEM_LIBRARIES` to `true`.
|
193
|
+
|
194
|
+
<div class="note warning">
|
195
|
+
<h5>Be sure to exclude <code>vendor</code> from your
|
196
|
+
<code>_config.yml</code></h5>
|
197
|
+
<p>Travis bundles all gems in the <code>vendor</code> directory on its build
|
198
|
+
servers, which Jekyll will mistakenly read and explode on.</p>
|
199
|
+
</div>
|
200
|
+
|
201
|
+
{% highlight yaml %}
|
202
|
+
exclude: [vendor]
|
203
|
+
{% endhighlight %}
|
204
|
+
|
205
|
+
### Troubleshooting
|
206
|
+
|
207
|
+
**Travis error:** *"You are trying to install in deployment mode after changing
|
208
|
+
your Gemfile. Run bundle install elsewhere and add the updated Gemfile.lock
|
209
|
+
to version control."*
|
210
|
+
|
211
|
+
**Workaround:** Either run `bundle install` locally and commit your changes to
|
212
|
+
`Gemfile.lock`, or remove the `Gemfile.lock` file from your repository and add
|
213
|
+
an entry in the `.gitignore` file to avoid it from being checked in again.
|
214
|
+
|
215
|
+
### Questions?
|
216
|
+
|
217
|
+
This entire guide is open-source. Go ahead and [edit it][3] if you have a
|
218
|
+
fix or [ask for help][4] if you run into trouble and need some help.
|
219
|
+
|
220
|
+
[3]: https://github.com/jekyll/jekyll/edit/master/site/_docs/continuous-integration.md
|
221
|
+
[4]: http://jekyllrb.com/help/
|
@@ -0,0 +1,124 @@
|
|
1
|
+
---
|
2
|
+
layout: docs
|
3
|
+
title: Contributing
|
4
|
+
permalink: /docs/contributing/
|
5
|
+
---
|
6
|
+
|
7
|
+
So you've got an awesome idea to throw into Jekyll. Great! Please keep the
|
8
|
+
following in mind:
|
9
|
+
|
10
|
+
* **Use https://talk.jekyllrb.com for non-technical or indirect Jekyll questions that are not bugs.**
|
11
|
+
* **Contributions will not be accepted without tests or necessary documentation updates.**
|
12
|
+
* If you're creating a small fix or patch to an existing feature, just a simple
|
13
|
+
test will do. Please stay in the confines of the current test suite and use
|
14
|
+
[Shoulda](https://github.com/thoughtbot/shoulda/tree/master) and
|
15
|
+
[RSpec-Mocks](https://github.com/rspec/rspec-mocks).
|
16
|
+
* If it's a brand new feature, make sure to create a new
|
17
|
+
[Cucumber](https://github.com/cucumber/cucumber/) feature and reuse steps
|
18
|
+
where appropriate. Also, whipping up some documentation in your fork's `site`
|
19
|
+
would be appreciated, and once merged it will be transferred over to the main
|
20
|
+
`site`, jekyllrb.com.
|
21
|
+
* If your contribution changes any Jekyll behavior, make sure to update the
|
22
|
+
documentation. It lives in `site/_docs`. If the docs are missing information,
|
23
|
+
please feel free to add it in. Great docs make a great project!
|
24
|
+
* Please follow the [GitHub Ruby Styleguide](https://github.com/styleguide/ruby)
|
25
|
+
when modifying Ruby code.
|
26
|
+
* Please do your best to submit **small pull requests**. The easier the proposed
|
27
|
+
change is to review, the more likely it will be merged.
|
28
|
+
* When submitting a pull request, please make judicious use of the pull request
|
29
|
+
body. A description of what changes were made, the motivations behind the
|
30
|
+
changes and [any tasks completed or left to complete](http://git.io/gfm-tasks)
|
31
|
+
will also speed up review time.
|
32
|
+
|
33
|
+
<div class="note warning">
|
34
|
+
<h5>Contributions will not be accepted without tests</h5>
|
35
|
+
<p>
|
36
|
+
If you’re creating a small fix or patch to an existing feature, just
|
37
|
+
a simple test will do.
|
38
|
+
</p>
|
39
|
+
</div>
|
40
|
+
|
41
|
+
|
42
|
+
Test Dependencies
|
43
|
+
-----------------
|
44
|
+
|
45
|
+
To run the test suite and build the gem you'll need to install Jekyll's
|
46
|
+
dependencies. Simply run this command to get all setup:
|
47
|
+
|
48
|
+
<figure class="highlight"><pre><code>$ script/bootstrap</code></pre></figure>
|
49
|
+
|
50
|
+
Before you start, run the tests and make sure that they pass (to confirm your
|
51
|
+
environment is configured properly):
|
52
|
+
|
53
|
+
<figure class="highlight"><pre><code>$ script/cibuild</code></pre></figure>
|
54
|
+
|
55
|
+
If you are only updating a file in `test/`, you can use the command:
|
56
|
+
|
57
|
+
<figure class="highlight"><pre><code>$ script/test test/blah_test.rb</code></pre></figure>
|
58
|
+
|
59
|
+
If you are only updating a `.feature` file, you can use the command:
|
60
|
+
|
61
|
+
<figure class="highlight"><pre><code>$ script/cucumber features/blah.feature</code></pre></figure>
|
62
|
+
|
63
|
+
Both `script/test` and `script/cucumber` can be run without arguments to
|
64
|
+
run its entire respective suite.
|
65
|
+
|
66
|
+
Workflow
|
67
|
+
--------
|
68
|
+
|
69
|
+
Here's the most direct way to get your work merged into the project:
|
70
|
+
|
71
|
+
* Fork the project.
|
72
|
+
* Clone down your fork ( `git clone git@github.com:[username]/jekyll.git` ).
|
73
|
+
* Create a topic branch to contain your change ( `git checkout -b my_awesome_feature` ).
|
74
|
+
* Hack away, add tests. Not necessarily in that order.
|
75
|
+
* Make sure everything still passes by running `script/cibuild`.
|
76
|
+
* If necessary, rebase your commits into logical chunks, without errors.
|
77
|
+
* Push the branch up ( `git push origin my_awesome_feature` ).
|
78
|
+
* Create a pull request against jekyll/jekyll and describe what your change
|
79
|
+
does and the why you think it should be merged.
|
80
|
+
|
81
|
+
Updating Documentation
|
82
|
+
----------------------
|
83
|
+
|
84
|
+
We want the Jekyll documentation to be the best it can be. We've
|
85
|
+
open-sourced our docs and we welcome any pull requests if you find it
|
86
|
+
lacking.
|
87
|
+
|
88
|
+
You can find the documentation for jekyllrb.com in the
|
89
|
+
[site]({{ site.repository }}/tree/master/site) directory of
|
90
|
+
Jekyll's repo on GitHub.com.
|
91
|
+
|
92
|
+
All documentation pull requests should be directed at `master`. Pull
|
93
|
+
requests directed at another branch will not be accepted.
|
94
|
+
|
95
|
+
The [Jekyll wiki]({{ site.repository }}/wiki) on GitHub
|
96
|
+
can be freely updated without a pull request as all GitHub users have access.
|
97
|
+
|
98
|
+
If you want to add your plugin to the [list of plugins](/docs/plugins/#available-plugins),
|
99
|
+
please submit a pull request modifying the [plugins page source
|
100
|
+
file]({{ site.repository }}/blob/master/site/_docs/plugins.md) by adding a
|
101
|
+
link to your plugin under the proper subheading depending upon its type.
|
102
|
+
|
103
|
+
Gotchas
|
104
|
+
-------
|
105
|
+
|
106
|
+
* Please do not bump the gem version in your pull requests.
|
107
|
+
* Try to keep your patch(es) based from the latest commit on jekyll/jekyll.
|
108
|
+
The easier it is to apply your work, the less work the maintainers have to do,
|
109
|
+
which is always a good thing.
|
110
|
+
* Please don't tag your GitHub issue with [fix], [feature], etc. The maintainers
|
111
|
+
actively read the issues and will label it once they come across it.
|
112
|
+
|
113
|
+
Finally...
|
114
|
+
----------
|
115
|
+
|
116
|
+
<div class="note">
|
117
|
+
<h5>Let us know what could be better!</h5>
|
118
|
+
<p>
|
119
|
+
Both using and hacking on Jekyll should be fun, simple, and easy, so if for
|
120
|
+
some reason you find it’s a pain, please <a
|
121
|
+
href="{{ site.repository }}/issues/new">create an issue</a> on
|
122
|
+
GitHub describing your experience so we can make it better.
|
123
|
+
</p>
|
124
|
+
</div>
|
@@ -0,0 +1,151 @@
|
|
1
|
+
---
|
2
|
+
layout: docs
|
3
|
+
title: Data Files
|
4
|
+
permalink: /docs/datafiles/
|
5
|
+
---
|
6
|
+
|
7
|
+
In addition to the [built-in variables](../variables/) available from Jekyll,
|
8
|
+
you can specify your own custom data that can be accessed via the [Liquid
|
9
|
+
templating system](https://wiki.github.com/shopify/liquid/liquid-for-designers).
|
10
|
+
|
11
|
+
Jekyll supports loading data from [YAML](http://yaml.org/), [JSON](http://www.json.org/),
|
12
|
+
and [CSV](https://en.wikipedia.org/wiki/Comma-separated_values) files located in the `_data` directory.
|
13
|
+
Note that CSV files *must* contain a header row.
|
14
|
+
|
15
|
+
This powerful feature allows you to avoid repetition in your templates and to
|
16
|
+
set site specific options without changing `_config.yml`.
|
17
|
+
|
18
|
+
Plugins/themes can also leverage Data Files to set configuration variables.
|
19
|
+
|
20
|
+
## The Data Folder
|
21
|
+
|
22
|
+
As explained on the [directory structure](../structure/) page, the `_data`
|
23
|
+
folder is where you can store additional data for Jekyll to use when generating
|
24
|
+
your site. These files must be YAML files
|
25
|
+
(using either the `.yml`, `.yaml`, `.json` or `csv` extension) and they will be
|
26
|
+
accessible via `site.data`.
|
27
|
+
|
28
|
+
## Example: List of members
|
29
|
+
|
30
|
+
Here is a basic example of using Data Files to avoid copy-pasting large chunks
|
31
|
+
of code in your Jekyll templates:
|
32
|
+
|
33
|
+
In `_data/members.yml`:
|
34
|
+
|
35
|
+
{% highlight yaml %}
|
36
|
+
- name: Tom Preston-Werner
|
37
|
+
github: mojombo
|
38
|
+
|
39
|
+
- name: Parker Moore
|
40
|
+
github: parkr
|
41
|
+
|
42
|
+
- name: Liu Fengyun
|
43
|
+
github: liufengyun
|
44
|
+
{% endhighlight %}
|
45
|
+
|
46
|
+
Or `_data/members.csv`:
|
47
|
+
|
48
|
+
{% highlight text %}
|
49
|
+
name,github
|
50
|
+
Tom Preston-Werner,mojombo
|
51
|
+
Parker Moore,parkr
|
52
|
+
Liu Fengyun,liufengyun
|
53
|
+
{% endhighlight %}
|
54
|
+
|
55
|
+
This data can be accessed via `site.data.members` (notice that the filename
|
56
|
+
determines the variable name).
|
57
|
+
|
58
|
+
You can now render the list of members in a template:
|
59
|
+
|
60
|
+
{% highlight html %}
|
61
|
+
{% raw %}
|
62
|
+
<ul>
|
63
|
+
{% for member in site.data.members %}
|
64
|
+
<li>
|
65
|
+
<a href="https://github.com/{{ member.github }}">
|
66
|
+
{{ member.name }}
|
67
|
+
</a>
|
68
|
+
</li>
|
69
|
+
{% endfor %}
|
70
|
+
</ul>
|
71
|
+
{% endraw %}
|
72
|
+
{% endhighlight %}
|
73
|
+
|
74
|
+
## Example: Organizations
|
75
|
+
|
76
|
+
Data files can also be placed in sub-folders of the `_data` folder. Each folder
|
77
|
+
level will be added to a variable's namespace. The example below shows how
|
78
|
+
GitHub organizations could be defined separately in a file under the `orgs`
|
79
|
+
folder:
|
80
|
+
|
81
|
+
In `_data/orgs/jekyll.yml`:
|
82
|
+
|
83
|
+
{% highlight yaml %}
|
84
|
+
username: jekyll
|
85
|
+
name: Jekyll
|
86
|
+
members:
|
87
|
+
- name: Tom Preston-Werner
|
88
|
+
github: mojombo
|
89
|
+
|
90
|
+
- name: Parker Moore
|
91
|
+
github: parkr
|
92
|
+
{% endhighlight %}
|
93
|
+
|
94
|
+
In `_data/orgs/doeorg.yml`:
|
95
|
+
|
96
|
+
{% highlight yaml %}
|
97
|
+
username: doeorg
|
98
|
+
name: Doe Org
|
99
|
+
members:
|
100
|
+
- name: John Doe
|
101
|
+
github: jdoe
|
102
|
+
{% endhighlight %}
|
103
|
+
|
104
|
+
The organizations can then be accessed via `site.data.orgs`, followed by the
|
105
|
+
file name:
|
106
|
+
|
107
|
+
{% highlight html %}
|
108
|
+
{% raw %}
|
109
|
+
<ul>
|
110
|
+
{% for org_hash in site.data.orgs %}
|
111
|
+
{% assign org = org_hash[1] %}
|
112
|
+
<li>
|
113
|
+
<a href="https://github.com/{{ org.username }}">
|
114
|
+
{{ org.name }}
|
115
|
+
</a>
|
116
|
+
({{ org.members | size }} members)
|
117
|
+
</li>
|
118
|
+
{% endfor %}
|
119
|
+
</ul>
|
120
|
+
{% endraw %}
|
121
|
+
{% endhighlight %}
|
122
|
+
|
123
|
+
## Example: Accessing a specific author
|
124
|
+
|
125
|
+
Pages and posts can also access a specific data item. The example below shows how to access a specific item:
|
126
|
+
|
127
|
+
`_data/people.yml`:
|
128
|
+
{% highlight yaml %}
|
129
|
+
dave:
|
130
|
+
name: David Smith
|
131
|
+
twitter: DavidSilvaSmith
|
132
|
+
{% endhighlight %}
|
133
|
+
|
134
|
+
The author can then be specified as a page variable in a post's frontmatter:
|
135
|
+
|
136
|
+
{% highlight html %}
|
137
|
+
{% raw %}
|
138
|
+
---
|
139
|
+
title: sample post
|
140
|
+
author: dave
|
141
|
+
---
|
142
|
+
|
143
|
+
{% assign author = site.data.people[page.author] %}
|
144
|
+
<a rel="author"
|
145
|
+
href="{{ author.twitter }}"
|
146
|
+
title="{{ author.name }}">
|
147
|
+
{{ author.name }}
|
148
|
+
</a>
|
149
|
+
|
150
|
+
{% endraw %}
|
151
|
+
{% endhighlight %}
|