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
data/site/_docs/index.md
ADDED
@@ -0,0 +1,56 @@
|
|
1
|
+
---
|
2
|
+
layout: docs
|
3
|
+
title: Welcome
|
4
|
+
permalink: /docs/home/
|
5
|
+
---
|
6
|
+
|
7
|
+
This site aims to be a comprehensive guide to Jekyll. We’ll cover topics such
|
8
|
+
as getting your site up and running, creating and managing your content,
|
9
|
+
customizing the way your site works and looks, deploying to various
|
10
|
+
environments, and give you some advice on participating in the future
|
11
|
+
development of Jekyll itself.
|
12
|
+
|
13
|
+
## So what is Jekyll, exactly?
|
14
|
+
|
15
|
+
Jekyll is a simple, blog-aware, static site generator. It takes a template
|
16
|
+
directory containing raw text files in various formats, runs it through
|
17
|
+
a converter (like [Markdown](http://daringfireball.net/projects/markdown/))
|
18
|
+
and our [Liquid](https://github.com/Shopify/liquid/wiki) renderer, and
|
19
|
+
spits out a complete, ready-to-publish static website suitable
|
20
|
+
for serving with your favorite web server. Jekyll also happens to be the engine
|
21
|
+
behind [GitHub Pages](http://pages.github.com), which means you can use Jekyll
|
22
|
+
to host your project’s page, blog, or website from GitHub’s servers **for
|
23
|
+
free**.
|
24
|
+
|
25
|
+
## Helpful Hints
|
26
|
+
|
27
|
+
Throughout this guide there are a number of small-but-handy pieces of
|
28
|
+
information that can make using Jekyll easier, more interesting, and less
|
29
|
+
hazardous. Here’s what to look out for.
|
30
|
+
|
31
|
+
<div class="note">
|
32
|
+
<h5>ProTips™ help you get more from Jekyll</h5>
|
33
|
+
<p>These are tips and tricks that will help you be a Jekyll wizard!</p>
|
34
|
+
</div>
|
35
|
+
|
36
|
+
<div class="note info">
|
37
|
+
<h5>Notes are handy pieces of information</h5>
|
38
|
+
<p>These are for the extra tidbits sometimes necessary to understand
|
39
|
+
Jekyll.</p>
|
40
|
+
</div>
|
41
|
+
|
42
|
+
<div class="note warning">
|
43
|
+
<h5>Warnings help you not blow things up</h5>
|
44
|
+
<p>Be aware of these messages if you wish to avoid certain death.</p>
|
45
|
+
</div>
|
46
|
+
|
47
|
+
<div class="note unreleased">
|
48
|
+
<h5>You'll see this by a feature that hasn't been released</h5>
|
49
|
+
<p>Some pieces of this website are for future versions of Jekyll that
|
50
|
+
are not yet released.</p>
|
51
|
+
</div>
|
52
|
+
|
53
|
+
If you come across anything along the way that we haven’t covered, or if you
|
54
|
+
know of a tip you think others would find handy, please [file an
|
55
|
+
issue]({{ site.repository }}/issues/new) and we’ll see about
|
56
|
+
including it in this guide.
|
@@ -0,0 +1,106 @@
|
|
1
|
+
---
|
2
|
+
layout: docs
|
3
|
+
title: Installation
|
4
|
+
permalink: /docs/installation/
|
5
|
+
---
|
6
|
+
|
7
|
+
Getting Jekyll installed and ready-to-go should only take a few minutes. If it
|
8
|
+
ever becomes a pain in the ass, please [file an
|
9
|
+
issue]({{ site.repository }}/issues/new) (or submit a pull request)
|
10
|
+
describing the issue you encountered and how we might make the process easier.
|
11
|
+
|
12
|
+
### Requirements
|
13
|
+
|
14
|
+
Installing Jekyll is easy and straight-forward, but there are a few
|
15
|
+
requirements you’ll need to make sure your system has before you start.
|
16
|
+
|
17
|
+
- [Ruby](http://www.ruby-lang.org/en/downloads/) (including development
|
18
|
+
headers, v1.9.3 or above for Jekyll 2 and v2 or above for Jekyll 3)
|
19
|
+
- [RubyGems](http://rubygems.org/pages/download)
|
20
|
+
- Linux, Unix, or Mac OS X
|
21
|
+
- [NodeJS](http://nodejs.org), or another JavaScript runtime (Jekyll 2 and
|
22
|
+
earlier, for CoffeeScript support).
|
23
|
+
- [Python 2.7](https://www.python.org/downloads/) (for Jekyll 2 and earlier)
|
24
|
+
|
25
|
+
<div class="note info">
|
26
|
+
<h5>Running Jekyll on Windows</h5>
|
27
|
+
<p>
|
28
|
+
While Windows is not officially supported, it is possible to get it running
|
29
|
+
on Windows. Special instructions can be found on our
|
30
|
+
<a href="../windows/#installation">Windows-specific docs page</a>.
|
31
|
+
</p>
|
32
|
+
</div>
|
33
|
+
|
34
|
+
## Install with RubyGems
|
35
|
+
|
36
|
+
The best way to install Jekyll is via
|
37
|
+
[RubyGems](http://rubygems.org/pages/download). At the terminal prompt,
|
38
|
+
simply run the following command to install Jekyll:
|
39
|
+
|
40
|
+
{% highlight bash %}
|
41
|
+
$ gem install jekyll
|
42
|
+
{% endhighlight %}
|
43
|
+
|
44
|
+
All of Jekyll’s gem dependencies are automatically installed by the above
|
45
|
+
command, so you won’t have to worry about them at all. If you have problems
|
46
|
+
installing Jekyll, check out the [troubleshooting](../troubleshooting/) page or
|
47
|
+
[report an issue]({{ site.repository }}/issues/new) so the Jekyll
|
48
|
+
community can improve the experience for everyone.
|
49
|
+
|
50
|
+
<div class="note info">
|
51
|
+
<h5>Installing Xcode Command-Line Tools</h5>
|
52
|
+
<p>
|
53
|
+
If you run into issues installing Jekyll's dependencies which make use of
|
54
|
+
native extensions and are using Mac OS X, you will need to install Xcode
|
55
|
+
and the Command-Line Tools it ships with. Download in
|
56
|
+
<code>Preferences → Downloads → Components</code>.
|
57
|
+
</p>
|
58
|
+
</div>
|
59
|
+
|
60
|
+
## Pre-releases
|
61
|
+
|
62
|
+
In order to install a pre-release, make sure you have all the requirements
|
63
|
+
installed properly and run:
|
64
|
+
|
65
|
+
{% highlight bash %}
|
66
|
+
gem install jekyll --pre
|
67
|
+
{% endhighlight %}
|
68
|
+
|
69
|
+
This will install the latest pre-release. If you want a particular pre-release,
|
70
|
+
use the `-v` switch to indicate the version you'd like to install:
|
71
|
+
|
72
|
+
{% highlight bash %}
|
73
|
+
gem install jekyll -v '2.0.0.alpha.1'
|
74
|
+
{% endhighlight %}
|
75
|
+
|
76
|
+
If you'd like to install a development version of Jekyll, the process is a bit
|
77
|
+
more involved. This gives you the advantage of having the latest and greatest,
|
78
|
+
but may be unstable.
|
79
|
+
|
80
|
+
{% highlight bash %}
|
81
|
+
$ git clone git://github.com/jekyll/jekyll.git
|
82
|
+
$ cd jekyll
|
83
|
+
$ script/bootstrap
|
84
|
+
$ bundle exec rake build
|
85
|
+
$ ls pkg/*.gem | head -n 1 | xargs gem install -l
|
86
|
+
{% endhighlight %}
|
87
|
+
|
88
|
+
## Optional Extras
|
89
|
+
|
90
|
+
There are a number of (optional) extra features that Jekyll supports that you
|
91
|
+
may want to install, depending on how you plan to use Jekyll. These extras
|
92
|
+
include LaTeX support, and the use of alternative content rendering engines.
|
93
|
+
Check out [the extras page](../extras/) for more information.
|
94
|
+
|
95
|
+
<div class="note">
|
96
|
+
<h5>ProTip™: Enable Syntax Highlighting</h5>
|
97
|
+
<p>
|
98
|
+
If you’re the kind of person who is using Jekyll, then chances are you’ll
|
99
|
+
want to enable syntax highlighting using <a href="http://pygments.org/">Pygments</a>
|
100
|
+
or <a href="https://github.com/jayferd/rouge">Rouge</a>. You should really
|
101
|
+
<a href="../templates/#code-snippet-highlighting">check out how to
|
102
|
+
do that</a> before you go any farther.
|
103
|
+
</p>
|
104
|
+
</div>
|
105
|
+
|
106
|
+
Now that you’ve got everything installed, let’s get to work!
|
@@ -0,0 +1,9 @@
|
|
1
|
+
---
|
2
|
+
layout: docs
|
3
|
+
title: Blog migrations
|
4
|
+
permalink: /docs/migrations/
|
5
|
+
---
|
6
|
+
|
7
|
+
If you’re switching to Jekyll from another blogging system, Jekyll’s importers
|
8
|
+
can help you with the move. To learn more about importing your site to Jekyll,
|
9
|
+
visit our [`jekyll-import` docs site](http://import.jekyllrb.com/docs/home/).
|
data/site/_docs/pages.md
ADDED
@@ -0,0 +1,84 @@
|
|
1
|
+
---
|
2
|
+
layout: docs
|
3
|
+
title: Creating pages
|
4
|
+
permalink: /docs/pages/
|
5
|
+
---
|
6
|
+
|
7
|
+
In addition to [writing posts](../posts/), another thing you may want to do
|
8
|
+
with your Jekyll site is create static pages. By taking advantage of the way
|
9
|
+
Jekyll copies files and directories, this is easy to do.
|
10
|
+
|
11
|
+
## Homepage
|
12
|
+
|
13
|
+
Just about every web server configuration you come across will look for an HTML
|
14
|
+
file called `index.html` (by convention) in the site's root folder and display
|
15
|
+
that as the homepage. Unless the web server you’re using is configured to look
|
16
|
+
for some different filename as the default, this file will turn into the
|
17
|
+
homepage of your Jekyll-generated site.
|
18
|
+
|
19
|
+
<div class="note">
|
20
|
+
<h5>ProTip™: Use layouts on your homepage</h5>
|
21
|
+
<p>
|
22
|
+
Any HTML file on your site can use layouts and/or includes, even the
|
23
|
+
homepage. Common content, like headers and footers, make excellent
|
24
|
+
candidates for extraction into a layout.
|
25
|
+
</p>
|
26
|
+
</div>
|
27
|
+
|
28
|
+
## Where additional pages live
|
29
|
+
|
30
|
+
Where you put HTML files for pages depends on how you want the pages to work.
|
31
|
+
There are two main ways of creating pages:
|
32
|
+
|
33
|
+
- Place named HTML files for each page in your site's root folder.
|
34
|
+
- Create a folder in the site's root for each page, and place an index.html
|
35
|
+
file in each page folder.
|
36
|
+
|
37
|
+
Both methods work fine (and can be used in conjunction with each other),
|
38
|
+
with the only real difference being the resulting URLs.
|
39
|
+
|
40
|
+
### Named HTML files
|
41
|
+
|
42
|
+
The simplest way of adding a page is just to add an HTML file in the root
|
43
|
+
directory with a suitable name for the page you want to create. For a site with
|
44
|
+
a homepage, an about page, and a contact page, here’s what the root directory
|
45
|
+
and associated URLs might look like:
|
46
|
+
|
47
|
+
{% highlight bash %}
|
48
|
+
.
|
49
|
+
|-- _config.yml
|
50
|
+
|-- _includes/
|
51
|
+
|-- _layouts/
|
52
|
+
|-- _posts/
|
53
|
+
|-- _site/
|
54
|
+
|-- about.html # => http://example.com/about.html
|
55
|
+
|-- index.html # => http://example.com/
|
56
|
+
└── contact.html # => http://example.com/contact.html
|
57
|
+
{% endhighlight %}
|
58
|
+
|
59
|
+
### Named folders containing index HTML files
|
60
|
+
|
61
|
+
There is nothing wrong with the above method. However, some people like to keep
|
62
|
+
their URLs free from things like filename extensions. To achieve clean URLs for
|
63
|
+
pages using Jekyll, you simply need to create a folder for each top-level page
|
64
|
+
you want, and then place an `index.html` file in each page’s folder. This way
|
65
|
+
the page URL ends up being the folder name, and the web server will serve up
|
66
|
+
the respective `index.html` file. Here's an example of what this structure
|
67
|
+
might look like:
|
68
|
+
|
69
|
+
{% highlight bash %}
|
70
|
+
.
|
71
|
+
├── _config.yml
|
72
|
+
├── _includes/
|
73
|
+
├── _layouts/
|
74
|
+
├── _posts/
|
75
|
+
├── _site/
|
76
|
+
├── about/
|
77
|
+
| └── index.html # => http://example.com/about/
|
78
|
+
├── contact/
|
79
|
+
| └── index.html # => http://example.com/contact/
|
80
|
+
└── index.html # => http://example.com/
|
81
|
+
{% endhighlight %}
|
82
|
+
|
83
|
+
This approach may not suit everyone, but for people who like clean URLs it’s
|
84
|
+
simple and it works. In the end the decision is yours!
|
@@ -0,0 +1,221 @@
|
|
1
|
+
---
|
2
|
+
layout: docs
|
3
|
+
title: Pagination
|
4
|
+
permalink: /docs/pagination/
|
5
|
+
---
|
6
|
+
|
7
|
+
With many websites—especially blogs—it’s very common to break the main listing
|
8
|
+
of posts up into smaller lists and display them over multiple pages. Jekyll has
|
9
|
+
pagination built-in, so you can automatically generate the appropriate files
|
10
|
+
and folders you need for paginated listings.
|
11
|
+
|
12
|
+
<div class="note info">
|
13
|
+
<h5>Pagination only works within HTML files</h5>
|
14
|
+
<p>
|
15
|
+
Pagination does not work from within Markdown or Textile files from
|
16
|
+
your Jekyll site. Pagination works when called from within the HTML
|
17
|
+
file, named <code>index.html</code>, which optionally may reside in and
|
18
|
+
produce pagination from within a subdirectory, via the
|
19
|
+
<code>paginate_path</code> configuration value.
|
20
|
+
</p>
|
21
|
+
</div>
|
22
|
+
|
23
|
+
## Enable pagination
|
24
|
+
|
25
|
+
To enable pagination for your blog, add a line to the `_config.yml` file that
|
26
|
+
specifies how many items should be displayed per page:
|
27
|
+
|
28
|
+
{% highlight yaml %}
|
29
|
+
paginate: 5
|
30
|
+
{% endhighlight %}
|
31
|
+
|
32
|
+
The number should be the maximum number of Posts you’d like to be displayed
|
33
|
+
per-page in the generated site.
|
34
|
+
|
35
|
+
You may also specify the destination of the pagination pages:
|
36
|
+
|
37
|
+
{% highlight yaml %}
|
38
|
+
paginate_path: "/blog/page:num/"
|
39
|
+
{% endhighlight %}
|
40
|
+
|
41
|
+
This will read in `blog/index.html`, send it each pagination page in Liquid as
|
42
|
+
`paginator` and write the output to `blog/page:num/`, where `:num` is the
|
43
|
+
pagination page number, starting with `2`. If a site has 12 posts and specifies
|
44
|
+
`paginate: 5`, Jekyll will write `blog/index.html` with the first 5 posts, `blog/page2/index.html` with the next 5 posts
|
45
|
+
and `blog/page3/index.html` with the last 2 posts into the destination
|
46
|
+
directory.
|
47
|
+
|
48
|
+
<div class="note warning">
|
49
|
+
<h5>Don't set a permalink</h5>
|
50
|
+
<p>
|
51
|
+
Setting a permalink in the front matter of your blog page will cause
|
52
|
+
pagination to break. Just omit the permalink.
|
53
|
+
</p>
|
54
|
+
</div>
|
55
|
+
|
56
|
+
## Liquid Attributes Available
|
57
|
+
|
58
|
+
The pagination plugin exposes the `paginator` liquid object with the following
|
59
|
+
attributes:
|
60
|
+
|
61
|
+
<div class="mobile-side-scroller">
|
62
|
+
<table>
|
63
|
+
<thead>
|
64
|
+
<tr>
|
65
|
+
<th>Attribute</th>
|
66
|
+
<th>Description</th>
|
67
|
+
</tr>
|
68
|
+
</thead>
|
69
|
+
<tbody>
|
70
|
+
<tr>
|
71
|
+
<td><p><code>page</code></p></td>
|
72
|
+
<td><p>current page number</p></td>
|
73
|
+
</tr>
|
74
|
+
<tr>
|
75
|
+
<td><p><code>per_page</code></p></td>
|
76
|
+
<td><p>number of posts per page</p></td>
|
77
|
+
</tr>
|
78
|
+
<tr>
|
79
|
+
<td><p><code>posts</code></p></td>
|
80
|
+
<td><p>a list of posts for the current page</p></td>
|
81
|
+
</tr>
|
82
|
+
<tr>
|
83
|
+
<td><p><code>total_posts</code></p></td>
|
84
|
+
<td><p>total number of posts in the site</p></td>
|
85
|
+
</tr>
|
86
|
+
<tr>
|
87
|
+
<td><p><code>total_pages</code></p></td>
|
88
|
+
<td><p>number of pagination pages</p></td>
|
89
|
+
</tr>
|
90
|
+
<tr>
|
91
|
+
<td><p><code>previous_page</code></p></td>
|
92
|
+
<td>
|
93
|
+
<p>
|
94
|
+
page number of the previous pagination page,
|
95
|
+
or <code>nil</code> if no previous page exists
|
96
|
+
</p>
|
97
|
+
</td>
|
98
|
+
</tr>
|
99
|
+
<tr>
|
100
|
+
<td><p><code>previous_page_path</code></p></td>
|
101
|
+
<td>
|
102
|
+
<p>
|
103
|
+
path of previous pagination page,
|
104
|
+
or <code>nil</code> if no previous page exists
|
105
|
+
</p>
|
106
|
+
</td>
|
107
|
+
</tr>
|
108
|
+
<tr>
|
109
|
+
<td><p><code>next_page</code></p></td>
|
110
|
+
<td>
|
111
|
+
<p>
|
112
|
+
page number of the next pagination page,
|
113
|
+
or <code>nil</code> if no subsequent page exists
|
114
|
+
</p>
|
115
|
+
</td>
|
116
|
+
</tr>
|
117
|
+
<tr>
|
118
|
+
<td><p><code>next_page_path</code></p></td>
|
119
|
+
<td>
|
120
|
+
<p>
|
121
|
+
path of next pagination page,
|
122
|
+
or <code>nil</code> if no subsequent page exists
|
123
|
+
</p>
|
124
|
+
</td>
|
125
|
+
</tr>
|
126
|
+
</tbody>
|
127
|
+
</table>
|
128
|
+
</div>
|
129
|
+
|
130
|
+
<div class="note info">
|
131
|
+
<h5>Pagination does not support tags or categories</h5>
|
132
|
+
<p>Pagination pages through every post in the <code>posts</code>
|
133
|
+
variable regardless of variables defined in the YAML Front Matter of
|
134
|
+
each. It does not currently allow paging over groups of posts linked
|
135
|
+
by a common tag or category. It cannot include any collection of
|
136
|
+
documents because it is restricted to posts.</p>
|
137
|
+
</div>
|
138
|
+
|
139
|
+
## Render the paginated Posts
|
140
|
+
|
141
|
+
The next thing you need to do is to actually display your posts in a list using
|
142
|
+
the `paginator` variable that will now be available to you. You’ll probably
|
143
|
+
want to do this in one of the main pages of your site. Here’s one example of a
|
144
|
+
simple way of rendering paginated Posts in a HTML file:
|
145
|
+
|
146
|
+
{% highlight html %}
|
147
|
+
{% raw %}
|
148
|
+
---
|
149
|
+
layout: default
|
150
|
+
title: My Blog
|
151
|
+
---
|
152
|
+
|
153
|
+
<!-- This loops through the paginated posts -->
|
154
|
+
{% for post in paginator.posts %}
|
155
|
+
<h1><a href="{{ post.url }}">{{ post.title }}</a></h1>
|
156
|
+
<p class="author">
|
157
|
+
<span class="date">{{ post.date }}</span>
|
158
|
+
</p>
|
159
|
+
<div class="content">
|
160
|
+
{{ post.content }}
|
161
|
+
</div>
|
162
|
+
{% endfor %}
|
163
|
+
|
164
|
+
<!-- Pagination links -->
|
165
|
+
<div class="pagination">
|
166
|
+
{% if paginator.previous_page %}
|
167
|
+
<a href="{{ paginator.previous_page_path }}" class="previous">Previous</a>
|
168
|
+
{% else %}
|
169
|
+
<span class="previous">Previous</span>
|
170
|
+
{% endif %}
|
171
|
+
<span class="page_number ">Page: {{ paginator.page }} of {{ paginator.total_pages }}</span>
|
172
|
+
{% if paginator.next_page %}
|
173
|
+
<a href="{{ paginator.next_page_path }}" class="next">Next</a>
|
174
|
+
{% else %}
|
175
|
+
<span class="next ">Next</span>
|
176
|
+
{% endif %}
|
177
|
+
</div>
|
178
|
+
{% endraw %}
|
179
|
+
{% endhighlight %}
|
180
|
+
|
181
|
+
<div class="note warning">
|
182
|
+
<h5>Beware the page one edge-case</h5>
|
183
|
+
<p>
|
184
|
+
Jekyll does not generate a ‘page1’ folder, so the above code will not work
|
185
|
+
when a <code>/page1</code> link is produced. See below for a way to handle
|
186
|
+
this if it’s a problem for you.
|
187
|
+
</p>
|
188
|
+
</div>
|
189
|
+
|
190
|
+
The following HTML snippet should handle page one, and render a list of each
|
191
|
+
page with links to all but the current page.
|
192
|
+
|
193
|
+
{% highlight html %}
|
194
|
+
{% raw %}
|
195
|
+
{% if paginator.total_pages > 1 %}
|
196
|
+
<div class="pagination">
|
197
|
+
{% if paginator.previous_page %}
|
198
|
+
<a href="{{ paginator.previous_page_path | prepend: site.baseurl | replace: '//', '/' }}">« Prev</a>
|
199
|
+
{% else %}
|
200
|
+
<span>« Prev</span>
|
201
|
+
{% endif %}
|
202
|
+
|
203
|
+
{% for page in (1..paginator.total_pages) %}
|
204
|
+
{% if page == paginator.page %}
|
205
|
+
<em>{{ page }}</em>
|
206
|
+
{% elsif page == 1 %}
|
207
|
+
<a href="{{ paginator.previous_page_path | prepend: site.baseurl | replace: '//', '/' }}">{{ page }}</a>
|
208
|
+
{% else %}
|
209
|
+
<a href="{{ site.paginate_path | prepend: site.baseurl | replace: '//', '/' | replace: ':num', page }}">{{ page }}</a>
|
210
|
+
{% endif %}
|
211
|
+
{% endfor %}
|
212
|
+
|
213
|
+
{% if paginator.next_page %}
|
214
|
+
<a href="{{ paginator.next_page_path | prepend: site.baseurl | replace: '//', '/' }}">Next »</a>
|
215
|
+
{% else %}
|
216
|
+
<span>Next »</span>
|
217
|
+
{% endif %}
|
218
|
+
</div>
|
219
|
+
{% endif %}
|
220
|
+
{% endraw %}
|
221
|
+
{% endhighlight %}
|