tigefa 1.0.0 → 1.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CONTRIBUTING.markdown +91 -0
- data/Gemfile +2 -0
- data/History.markdown +871 -0
- data/LICENSE +15 -14
- data/README.markdown +59 -0
- data/Rakefile +298 -0
- data/bin/tigefa +158 -0
- data/cucumber.yml +3 -0
- data/features/create_sites.feature +141 -0
- data/features/data.feature +65 -0
- data/features/drafts.feature +25 -0
- data/features/embed_filters.feature +60 -0
- data/features/include_tag.feature +57 -0
- data/features/markdown.feature +67 -0
- data/features/pagination.feature +82 -0
- data/features/permalinks.feature +85 -0
- data/features/post_data.feature +214 -0
- data/features/post_excerpts.feature +50 -0
- data/features/site_configuration.feature +235 -0
- data/features/site_data.feature +107 -0
- data/features/step_definitions/tigefa_steps.rb +189 -0
- data/features/support/env.rb +75 -0
- data/lib/site_template/.gitignore +1 -0
- data/lib/site_template/_config.yml +3 -0
- data/lib/site_template/_layouts/default.html +44 -0
- data/lib/site_template/_layouts/post.html +9 -0
- data/lib/site_template/_posts/0000-00-00-welcome-to-jekyll.markdown.erb +24 -0
- data/lib/site_template/css/main.css +160 -0
- data/lib/site_template/css/syntax.css +60 -0
- data/lib/site_template/index.html +13 -0
- data/lib/tigefa/cleaner.rb +73 -0
- data/lib/tigefa/command.rb +27 -0
- data/lib/tigefa/commands/build.rb +70 -0
- data/lib/tigefa/commands/doctor.rb +67 -0
- data/lib/tigefa/commands/new.rb +67 -0
- data/lib/tigefa/commands/serve.rb +65 -0
- data/lib/tigefa/configuration.rb +238 -0
- data/lib/tigefa/converter.rb +48 -0
- data/lib/tigefa/converters/identity.rb +21 -0
- data/lib/tigefa/converters/markdown/kramdown_parser.rb +29 -0
- data/lib/tigefa/converters/markdown/maruku_parser.rb +56 -0
- data/lib/tigefa/converters/markdown/rdiscount_parser.rb +37 -0
- data/lib/tigefa/converters/markdown/redcarpet_parser.rb +70 -0
- data/lib/tigefa/converters/markdown.rb +43 -0
- data/lib/tigefa/converters/textile.rb +50 -0
- data/lib/tigefa/convertible.rb +174 -0
- data/lib/tigefa/core_ext.rb +90 -0
- data/lib/tigefa/deprecator.rb +36 -0
- data/lib/tigefa/draft.rb +35 -0
- data/lib/tigefa/entry_filter.rb +35 -0
- data/lib/tigefa/errors.rb +4 -0
- data/lib/tigefa/excerpt.rb +113 -0
- data/lib/tigefa/filters.rb +174 -0
- data/lib/tigefa/generator.rb +4 -0
- data/lib/tigefa/generators/pagination.rb +217 -0
- data/lib/tigefa/layout.rb +45 -0
- data/lib/tigefa/mime.types +85 -0
- data/lib/tigefa/page.rb +160 -0
- data/lib/tigefa/plugin.rb +75 -0
- data/lib/tigefa/post.rb +312 -0
- data/lib/tigefa/related_posts.rb +59 -0
- data/lib/tigefa/site.rb +427 -0
- data/lib/tigefa/static_file.rb +70 -0
- data/lib/tigefa/stevenson.rb +89 -0
- data/lib/tigefa/tags/gist.rb +48 -0
- data/lib/tigefa/tags/highlight.rb +85 -0
- data/lib/tigefa/tags/include.rb +134 -0
- data/lib/tigefa/tags/post_url.rb +63 -0
- data/lib/tigefa/url.rb +69 -0
- data/lib/tigefa.rb +98 -4
- data/script/bootstrap +2 -0
- data/site/.gitignore +4 -0
- data/site/CNAME +1 -0
- data/site/README +1 -0
- data/site/_config.yml +6 -0
- data/site/_includes/analytics.html +32 -0
- data/site/_includes/docs_contents.html +16 -0
- data/site/_includes/docs_contents_mobile.html +23 -0
- data/site/_includes/docs_option.html +11 -0
- data/site/_includes/docs_ul.html +20 -0
- data/site/_includes/footer.html +15 -0
- data/site/_includes/header.html +18 -0
- data/site/_includes/news_contents.html +23 -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 +14 -0
- data/site/_includes/section_nav.html +22 -0
- data/site/_includes/top.html +17 -0
- data/site/_layouts/default.html +12 -0
- data/site/_layouts/docs.html +23 -0
- data/site/_layouts/news.html +19 -0
- data/site/_layouts/news_item.html +27 -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 +19 -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-16-jekyll-1-4-2-released.markdown +18 -0
- data/site/_posts/2014-01-13-jekyll-1-4-3-released.markdown +27 -0
- data/site/css/gridism.css +110 -0
- data/site/css/normalize.css +1 -0
- data/site/css/pygments.css +70 -0
- data/site/css/style.css +946 -0
- data/site/docs/configuration.md +375 -0
- data/site/docs/contributing.md +128 -0
- data/site/docs/datafiles.md +63 -0
- data/site/docs/deployment-methods.md +109 -0
- data/site/docs/drafts.md +21 -0
- data/site/docs/extras.md +56 -0
- data/site/docs/frontmatter.md +180 -0
- data/site/docs/github-pages.md +91 -0
- data/site/docs/heroku.md +9 -0
- data/site/docs/history.md +866 -0
- data/site/docs/index.md +52 -0
- data/site/docs/installation.md +76 -0
- data/site/docs/migrations.md +11 -0
- data/site/docs/pages.md +86 -0
- data/site/docs/pagination.md +211 -0
- data/site/docs/permalinks.md +180 -0
- data/site/docs/plugins.md +534 -0
- data/site/docs/posts.md +181 -0
- data/site/docs/quickstart.md +32 -0
- data/site/docs/resources.md +46 -0
- data/site/docs/sites.md +29 -0
- data/site/docs/structure.md +190 -0
- data/site/docs/templates.md +339 -0
- data/site/docs/troubleshooting.md +150 -0
- data/site/docs/upgrading.md +146 -0
- data/site/docs/usage.md +63 -0
- data/site/docs/variables.md +322 -0
- data/site/favicon.png +0 -0
- data/site/feed.xml +36 -0
- data/site/freenode.txt +1 -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/logo-2x.png +0 -0
- data/site/img/octojekyll.png +0 -0
- data/site/img/tube.png +0 -0
- data/site/img/tube1x.png +0 -0
- data/site/index.html +90 -0
- data/site/js/modernizr-2.5.3.min.js +4 -0
- data/site/news/index.html +10 -0
- data/site/news/releases/index.html +10 -0
- data/test/fixtures/broken_front_matter1.erb +5 -0
- data/test/fixtures/broken_front_matter2.erb +4 -0
- data/test/fixtures/broken_front_matter3.erb +7 -0
- data/test/fixtures/exploit_front_matter.erb +4 -0
- data/test/fixtures/front_matter.erb +4 -0
- data/test/helper.rb +65 -0
- data/test/source/+/foo.md +7 -0
- data/test/source/.htaccess +8 -0
- data/test/source/_config.dev.toml +2 -0
- data/test/source/_data/languages.yml +2 -0
- data/test/source/_data/members.yaml +7 -0
- data/test/source/_data/products.yml +1 -0
- data/test/source/_includes/params.html +7 -0
- data/test/source/_includes/sig.markdown +3 -0
- data/test/source/_includes/tmp +1 -0
- data/test/source/_layouts/default.html +27 -0
- data/test/source/_layouts/post/simple.html +1 -0
- data/test/source/_layouts/simple.html +1 -0
- data/test/source/_plugins/dummy.rb +8 -0
- data/test/source/_posts/2008-02-02-not-published.textile +8 -0
- data/test/source/_posts/2008-02-02-published.textile +8 -0
- data/test/source/_posts/2008-10-18-foo-bar.textile +8 -0
- data/test/source/_posts/2008-11-21-complex.textile +8 -0
- data/test/source/_posts/2008-12-03-permalinked-post.textile +9 -0
- data/test/source/_posts/2008-12-13-include.markdown +8 -0
- data/test/source/_posts/2009-01-27-array-categories.textile +10 -0
- data/test/source/_posts/2009-01-27-categories.textile +7 -0
- data/test/source/_posts/2009-01-27-category.textile +7 -0
- data/test/source/_posts/2009-01-27-empty-categories.textile +7 -0
- data/test/source/_posts/2009-01-27-empty-category.textile +7 -0
- data/test/source/_posts/2009-03-12-hash-#1.markdown +6 -0
- data/test/source/_posts/2009-05-18-empty-tag.textile +6 -0
- data/test/source/_posts/2009-05-18-empty-tags.textile +6 -0
- data/test/source/_posts/2009-05-18-tag.textile +6 -0
- data/test/source/_posts/2009-05-18-tags.textile +9 -0
- data/test/source/_posts/2009-06-22-empty-yaml.textile +3 -0
- data/test/source/_posts/2009-06-22-no-yaml.textile +1 -0
- data/test/source/_posts/2010-01-08-triple-dash.markdown +5 -0
- data/test/source/_posts/2010-01-09-date-override.textile +7 -0
- data/test/source/_posts/2010-01-09-time-override.textile +7 -0
- data/test/source/_posts/2010-01-09-timezone-override.textile +7 -0
- data/test/source/_posts/2010-01-16-override-data.textile +4 -0
- data/test/source/_posts/2011-04-12-md-extension.md +7 -0
- data/test/source/_posts/2011-04-12-text-extension.text +0 -0
- data/test/source/_posts/2013-01-02-post-excerpt.markdown +14 -0
- data/test/source/_posts/2013-01-12-nil-layout.textile +6 -0
- data/test/source/_posts/2013-01-12-no-layout.textile +5 -0
- data/test/source/_posts/2013-03-19-not-a-post.markdown/.gitkeep +0 -0
- data/test/source/_posts/2013-04-11-custom-excerpt.markdown +10 -0
- data/test/source/_posts/2013-05-10-number-category.textile +7 -0
- data/test/source/_posts/2013-07-22-post-excerpt-with-layout.markdown +23 -0
- data/test/source/_posts/2013-08-01-mkdn-extension.mkdn +0 -0
- data/test/source/_posts/2014-01-06-permalink-traversal.md +5 -0
- data/test/source/_posts/es/2008-11-21-nested.textile +8 -0
- data/test/source/about.html +6 -0
- data/test/source/category/_posts/2008-9-23-categories.textile +6 -0
- data/test/source/contacts/bar.html +5 -0
- data/test/source/contacts/index.html +5 -0
- data/test/source/contacts.html +5 -0
- data/test/source/css/screen.css +76 -0
- data/test/source/deal.with.dots.html +7 -0
- data/test/source/exploit.md +5 -0
- data/test/source/foo/_posts/bar/2008-12-12-topical-post.textile +8 -0
- data/test/source/index.html +22 -0
- data/test/source/products.yml +4 -0
- data/test/source/sitemap.xml +32 -0
- data/test/source/symlink-test/_data +1 -0
- data/test/source/symlink-test/symlinked-dir +1 -0
- data/test/source/symlink-test/symlinked-file +1 -0
- data/test/source/win/_posts/2009-05-24-yaml-linebreak.markdown +7 -0
- data/test/source/z_category/_posts/2008-9-23-categories.textile +6 -0
- data/test/suite.rb +11 -0
- data/test/test_command.rb +39 -0
- data/test/test_configuration.rb +181 -0
- data/test/test_convertible.rb +51 -0
- data/test/test_core_ext.rb +88 -0
- data/test/test_entry_filter.rb +74 -0
- data/test/test_excerpt.rb +78 -0
- data/test/test_filters.rb +113 -0
- data/test/test_generated_site.rb +83 -0
- data/test/test_kramdown.rb +62 -0
- data/test/test_new_command.rb +104 -0
- data/test/test_page.rb +212 -0
- data/test/test_pager.rb +116 -0
- data/test/test_post.rb +592 -0
- data/test/test_rdiscount.rb +22 -0
- data/test/test_redcarpet.rb +61 -0
- data/test/test_redcloth.rb +86 -0
- data/test/test_related_posts.rb +47 -0
- data/test/test_site.rb +333 -0
- data/test/test_tags.rb +490 -0
- data/test/test_url.rb +28 -0
- data/tigefa.gemspec +306 -0
- metadata +575 -45
- data/README.md +0 -4
data/site/docs/index.md
ADDED
@@ -0,0 +1,52 @@
|
|
1
|
+
---
|
2
|
+
layout: docs
|
3
|
+
title: Welcome
|
4
|
+
next_section: quickstart
|
5
|
+
permalink: /docs/home/
|
6
|
+
---
|
7
|
+
|
8
|
+
This site aims to be a comprehensive guide to Jekyll. We’ll cover topics such
|
9
|
+
as getting your site up and running, creating and managing your content,
|
10
|
+
customizing the way your site works and looks, deploying to various
|
11
|
+
environments, and give you some advice on participating in the future
|
12
|
+
development of Jekyll itself.
|
13
|
+
|
14
|
+
## So what is Jekyll, exactly?
|
15
|
+
|
16
|
+
Jekyll is a simple, blog-aware, static site generator. It takes a template
|
17
|
+
directory containing raw text files in various formats, runs it through
|
18
|
+
[Markdown](http://daringfireball.net/projects/markdown/) (or
|
19
|
+
[Textile](http://textile.sitemonks.com/)) and
|
20
|
+
[Liquid](http://wiki.shopify.com/Liquid)
|
21
|
+
converters, and spits out a complete, ready-to-publish static website suitable
|
22
|
+
for serving with your favorite web server. Jekyll also happens to be the engine
|
23
|
+
behind [GitHub Pages](http://pages.github.com), which means you can use Jekyll
|
24
|
+
to host your project’s page, blog, or website from GitHub’s servers **for
|
25
|
+
free**.
|
26
|
+
|
27
|
+
## ProTips™, Notes, and Warnings
|
28
|
+
|
29
|
+
Throughout this guide there are a number of small-but-handy pieces of
|
30
|
+
information that can make using Jekyll easier, more interesting, and less
|
31
|
+
hazardous. Here’s what to look out for.
|
32
|
+
|
33
|
+
<div class="note">
|
34
|
+
<h5>ProTips™ help you get more from Jekyll</h5>
|
35
|
+
<p>These are tips and tricks that will help you be a Jekyll wizard!</p>
|
36
|
+
</div>
|
37
|
+
|
38
|
+
<div class="note info">
|
39
|
+
<h5>Notes are handy pieces of information</h5>
|
40
|
+
<p>These are for the extra tidbits sometimes necessary to understand
|
41
|
+
Jekyll.</p>
|
42
|
+
</div>
|
43
|
+
|
44
|
+
<div class="note warning">
|
45
|
+
<h5>Warnings help you not blow things up</h5>
|
46
|
+
<p>Be aware of these messages if you wish to avoid certain death.</p>
|
47
|
+
</div>
|
48
|
+
|
49
|
+
If you come across anything along the way that we haven’t covered, or if you
|
50
|
+
know of a tip you think others would find handy, please [file an
|
51
|
+
issue]({{ site.repository }}/issues/new) and we’ll see about
|
52
|
+
including it in this guide.
|
@@ -0,0 +1,76 @@
|
|
1
|
+
---
|
2
|
+
layout: docs
|
3
|
+
title: Installation
|
4
|
+
prev_section: quickstart
|
5
|
+
next_section: usage
|
6
|
+
permalink: /docs/installation/
|
7
|
+
---
|
8
|
+
|
9
|
+
Getting Jekyll installed and ready-to-go should only take a few minutes. If it
|
10
|
+
ever becomes a pain in the ass, please [file an
|
11
|
+
issue]({{ site.repository }}/issues/new) (or submit a pull request)
|
12
|
+
describing the issue you encountered and how we might make the process easier.
|
13
|
+
|
14
|
+
### Requirements
|
15
|
+
|
16
|
+
Installing Jekyll is easy and straight-forward, but there are a few requirements
|
17
|
+
you’ll need to make sure your system has before you start.
|
18
|
+
|
19
|
+
- [Ruby](http://www.ruby-lang.org/en/downloads/)
|
20
|
+
- [RubyGems](http://rubygems.org/pages/download)
|
21
|
+
- Linux, Unix, or Mac OS X
|
22
|
+
|
23
|
+
<div class="note info">
|
24
|
+
<h5>Running Jekyll on Windows</h5>
|
25
|
+
<p>
|
26
|
+
It is possible to get
|
27
|
+
<a href="http://www.madhur.co.in/blog/2011/09/01/runningjekyllwindows.html">
|
28
|
+
Jekyll running on Windows</a>, but the official documentation does not
|
29
|
+
support installation on Windows platforms.
|
30
|
+
</p>
|
31
|
+
</div>
|
32
|
+
|
33
|
+
## Install with RubyGems
|
34
|
+
|
35
|
+
The best way to install Jekyll is via
|
36
|
+
[RubyGems](http://docs.rubygems.org/read/chapter/3). At the terminal prompt,
|
37
|
+
simply run the following command to install Jekyll:
|
38
|
+
|
39
|
+
{% highlight bash %}
|
40
|
+
$ gem install jekyll
|
41
|
+
{% endhighlight %}
|
42
|
+
|
43
|
+
All of Jekyll’s gem dependencies are automatically installed by the above
|
44
|
+
command, so you won’t have to worry about them at all. If you have problems
|
45
|
+
installing Jekyll, check out the [troubleshooting](../troubleshooting/) page or
|
46
|
+
[report an issue]({{ site.repository }}/issues/new) so the Jekyll
|
47
|
+
community can improve the experience for everyone.
|
48
|
+
|
49
|
+
<div class="note info">
|
50
|
+
<h5>Installing Xcode Command-Line Tools</h5>
|
51
|
+
<p>
|
52
|
+
If you run into issues installing Jekyll's dependencies which make use of
|
53
|
+
native extensions and are using Mac OS X, you will need to install Xcode
|
54
|
+
and the Command-Line Tools it ships with. Download in
|
55
|
+
<code>Preferences → Downloads → Components</code>.
|
56
|
+
</p>
|
57
|
+
</div>
|
58
|
+
|
59
|
+
## Optional Extras
|
60
|
+
|
61
|
+
There are a number of (optional) extra features that Jekyll supports that you
|
62
|
+
may want to install, depending on how you plan to use Jekyll. These extras
|
63
|
+
include LaTeX support, and the use of alternative content rendering engines.
|
64
|
+
Check out [the extras page](../extras/) for more information.
|
65
|
+
|
66
|
+
<div class="note">
|
67
|
+
<h5>ProTip™: Enable Syntax Highlighting</h5>
|
68
|
+
<p>
|
69
|
+
If you’re the kind of person who is using Jekyll, then chances are you’ll
|
70
|
+
want to enable syntax highlighting using Pygments. You should really
|
71
|
+
<a href="../templates/#code_snippet_highlighting">check out how to do
|
72
|
+
that</a> before you go any further.
|
73
|
+
</p>
|
74
|
+
</div>
|
75
|
+
|
76
|
+
Now that you’ve got everything installed, let’s get to work!
|
@@ -0,0 +1,11 @@
|
|
1
|
+
---
|
2
|
+
layout: docs
|
3
|
+
title: Blog migrations
|
4
|
+
prev_section: datafiles
|
5
|
+
next_section: templates
|
6
|
+
permalink: /docs/migrations/
|
7
|
+
---
|
8
|
+
|
9
|
+
If you’re switching to Jekyll from another blogging system, Jekyll’s importers
|
10
|
+
can help you with the move. To learn more about importing your site to Jekyll,
|
11
|
+
visit our [`jekyll-import` docs site](http://import.jekyllrb.com).
|
data/site/docs/pages.md
ADDED
@@ -0,0 +1,86 @@
|
|
1
|
+
---
|
2
|
+
layout: docs
|
3
|
+
title: Creating pages
|
4
|
+
prev_section: drafts
|
5
|
+
next_section: variables
|
6
|
+
permalink: /docs/pages/
|
7
|
+
---
|
8
|
+
|
9
|
+
In addition to [writing posts](../posts/), another thing you may want to do with
|
10
|
+
your Jekyll site is create static pages. By taking advantage of the way Jekyll
|
11
|
+
copies files and directories, this is easy to do.
|
12
|
+
|
13
|
+
## Homepage
|
14
|
+
|
15
|
+
Just about every web server configuration you come across will look for an HTML
|
16
|
+
file called `index.html` (by convention) in the site's root folder and display
|
17
|
+
that as the homepage. Unless the web server you’re using is configured to look
|
18
|
+
for some different filename as the default, this file will turn into the
|
19
|
+
homepage of your Jekyll-generated site.
|
20
|
+
|
21
|
+
<div class="note">
|
22
|
+
<h5>ProTip™: Use layouts on your homepage</h5>
|
23
|
+
<p>
|
24
|
+
Any HTML file on your site can use layouts and/or includes, even the
|
25
|
+
homepage. Common content, like headers and footers, make excellent
|
26
|
+
candidates for extraction into a layout.
|
27
|
+
</p>
|
28
|
+
</div>
|
29
|
+
|
30
|
+
## Where additional pages live
|
31
|
+
|
32
|
+
Where you put HTML files for pages depends on how you want the pages to work.
|
33
|
+
There are two main ways of creating pages:
|
34
|
+
|
35
|
+
- Place named HTML files for each page in your site's root folder.
|
36
|
+
- Create a folder in the site's root for each page, and place an index.html file
|
37
|
+
in each page folder.
|
38
|
+
|
39
|
+
Both methods work fine (and can be used in conjunction with each other),
|
40
|
+
with the only real difference being the resulting URLs.
|
41
|
+
|
42
|
+
### Named HTML files
|
43
|
+
|
44
|
+
The simplest way of adding a page is just to add an HTML file in the root
|
45
|
+
directory with a suitable name for the page you want to create. For a site with
|
46
|
+
a homepage, an about page, and a contact page, here’s what the root directory
|
47
|
+
and associated URLs might look like:
|
48
|
+
|
49
|
+
{% highlight bash %}
|
50
|
+
.
|
51
|
+
|-- _config.yml
|
52
|
+
|-- _includes/
|
53
|
+
|-- _layouts/
|
54
|
+
|-- _posts/
|
55
|
+
|-- _site/
|
56
|
+
|-- about.html # => http://example.com/about.html
|
57
|
+
|-- index.html # => http://example.com/
|
58
|
+
└── contact.html # => http://example.com/contact.html
|
59
|
+
{% endhighlight %}
|
60
|
+
|
61
|
+
### Named folders containing index HTML files
|
62
|
+
|
63
|
+
There is nothing wrong with the above method, however some people like to keep
|
64
|
+
their URLs free from things like filename extensions. To achieve clean URLs for
|
65
|
+
pages using Jekyll, you simply need to create a folder for each top-level page
|
66
|
+
you want, and then place an `index.html` file in each page’s folder. This way
|
67
|
+
the page URL ends up being the folder name, and the web server will serve up the
|
68
|
+
respective `index.html` file. Here's an example of what this structure might
|
69
|
+
look like:
|
70
|
+
|
71
|
+
{% highlight bash %}
|
72
|
+
.
|
73
|
+
├── _config.yml
|
74
|
+
├── _includes/
|
75
|
+
├── _layouts/
|
76
|
+
├── _posts/
|
77
|
+
├── _site/
|
78
|
+
├── about/
|
79
|
+
| └── index.html # => http://example.com/about/
|
80
|
+
├── contact/
|
81
|
+
| └── index.html # => http://example.com/contact/
|
82
|
+
└── index.html # => http://example.com/
|
83
|
+
{% endhighlight %}
|
84
|
+
|
85
|
+
This approach may not suit everyone, but for people who like clean URLs it’s
|
86
|
+
simple and it works. In the end the decision is yours!
|
@@ -0,0 +1,211 @@
|
|
1
|
+
---
|
2
|
+
layout: docs
|
3
|
+
title: Pagination
|
4
|
+
prev_section: permalinks
|
5
|
+
next_section: plugins
|
6
|
+
permalink: /docs/pagination/
|
7
|
+
---
|
8
|
+
|
9
|
+
With many websites—especially blogs—it’s very common to break the main listing
|
10
|
+
of posts up into smaller lists and display them over multiple pages. Jekyll has
|
11
|
+
pagination built-in, so you can automatically generate the appropriate files and
|
12
|
+
folders you need for paginated listings.
|
13
|
+
|
14
|
+
<div class="note info">
|
15
|
+
<h5>Pagination only works within HTML files</h5>
|
16
|
+
<p>
|
17
|
+
Pagination does not work with Markdown or Textile files in your Jekyll site.
|
18
|
+
It will only work when used within HTML files. Since you’ll likely be using
|
19
|
+
this for the list of Posts, this shouldn’t be an issue.
|
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 per-
|
33
|
+
page in the generated site.
|
34
|
+
|
35
|
+
You may also specify where 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 `paginator`
|
42
|
+
and write the output to `blog/page:num`, where `:num` is the pagination page number,
|
43
|
+
starting with `2`. If a site has 12 posts and specifies `paginate: 5`, Jekyll will write
|
44
|
+
`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 directory.
|
46
|
+
|
47
|
+
## Liquid Attributes Available
|
48
|
+
|
49
|
+
The pagination plugin exposes the `paginator` liquid object with the following
|
50
|
+
attributes:
|
51
|
+
|
52
|
+
<div class="mobile-side-scroller">
|
53
|
+
<table>
|
54
|
+
<thead>
|
55
|
+
<tr>
|
56
|
+
<th>Attribute</th>
|
57
|
+
<th>Description</th>
|
58
|
+
</tr>
|
59
|
+
</thead>
|
60
|
+
<tbody>
|
61
|
+
<tr>
|
62
|
+
<td><p><code>page</code></p></td>
|
63
|
+
<td><p>current page number</p></td>
|
64
|
+
</tr>
|
65
|
+
<tr>
|
66
|
+
<td><p><code>per_page</code></p></td>
|
67
|
+
<td><p>number of posts per page</p></td>
|
68
|
+
</tr>
|
69
|
+
<tr>
|
70
|
+
<td><p><code>posts</code></p></td>
|
71
|
+
<td><p>a list of posts for the current page</p></td>
|
72
|
+
</tr>
|
73
|
+
<tr>
|
74
|
+
<td><p><code>total_posts</code></p></td>
|
75
|
+
<td><p>total number of posts in the site</p></td>
|
76
|
+
</tr>
|
77
|
+
<tr>
|
78
|
+
<td><p><code>total_pages</code></p></td>
|
79
|
+
<td><p>number of pagination pages</p></td>
|
80
|
+
</tr>
|
81
|
+
<tr>
|
82
|
+
<td><p><code>previous_page</code></p></td>
|
83
|
+
<td>
|
84
|
+
<p>
|
85
|
+
page number of the previous pagination page,
|
86
|
+
or <code>nil</code> if no previous page exists
|
87
|
+
</p>
|
88
|
+
</td>
|
89
|
+
</tr>
|
90
|
+
<tr>
|
91
|
+
<td><p><code>previous_page_path</code></p></td>
|
92
|
+
<td>
|
93
|
+
<p>
|
94
|
+
path of 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>next_page</code></p></td>
|
101
|
+
<td>
|
102
|
+
<p>
|
103
|
+
page number of the next pagination page,
|
104
|
+
or <code>nil</code> if no subsequent page exists
|
105
|
+
</p>
|
106
|
+
</td>
|
107
|
+
</tr>
|
108
|
+
<tr>
|
109
|
+
<td><p><code>next_page_path</code></p></td>
|
110
|
+
<td>
|
111
|
+
<p>
|
112
|
+
path of next pagination page,
|
113
|
+
or <code>nil</code> if no subsequent page exists
|
114
|
+
</p>
|
115
|
+
</td>
|
116
|
+
</tr>
|
117
|
+
</tbody>
|
118
|
+
</table>
|
119
|
+
</div>
|
120
|
+
|
121
|
+
<div class="note info">
|
122
|
+
<h5>Pagination does not support tags or categories</h5>
|
123
|
+
<p>Pagination pages through every post in the <code>posts</code>
|
124
|
+
variable regardless of variables defined in the YAML Front Matter of
|
125
|
+
each. It does not currently allow paging over groups of posts linked
|
126
|
+
by a common tag or category.</p>
|
127
|
+
</div>
|
128
|
+
|
129
|
+
## Render the paginated Posts
|
130
|
+
|
131
|
+
The next thing you need to do is to actually display your posts in a list using
|
132
|
+
the `paginator` variable that will now be available to you. You’ll probably want
|
133
|
+
to do this in one of the main pages of your site. Here’s one example of a simple
|
134
|
+
way of rendering paginated Posts in a HTML file:
|
135
|
+
|
136
|
+
{% highlight html %}
|
137
|
+
{% raw %}
|
138
|
+
---
|
139
|
+
layout: default
|
140
|
+
title: My Blog
|
141
|
+
---
|
142
|
+
|
143
|
+
<!-- This loops through the paginated posts -->
|
144
|
+
{% for post in paginator.posts %}
|
145
|
+
<h1><a href="{{ post.url }}">{{ post.title }}</a></h1>
|
146
|
+
<p class="author">
|
147
|
+
<span class="date">{{ post.date }}</span>
|
148
|
+
</p>
|
149
|
+
<div class="content">
|
150
|
+
{{ post.content }}
|
151
|
+
</div>
|
152
|
+
{% endfor %}
|
153
|
+
|
154
|
+
<!-- Pagination links -->
|
155
|
+
<div class="pagination">
|
156
|
+
{% if paginator.previous_page %}
|
157
|
+
<a href="/page{{ paginator.previous_page }}" class="previous">Previous</a>
|
158
|
+
{% else %}
|
159
|
+
<span class="previous">Previous</span>
|
160
|
+
{% endif %}
|
161
|
+
<span class="page_number ">Page: {{ paginator.page }} of {{ paginator.total_pages }}</span>
|
162
|
+
{% if paginator.next_page %}
|
163
|
+
<a href="/page{{ paginator.next_page }}" class="next">Next</a>
|
164
|
+
{% else %}
|
165
|
+
<span class="next ">Next</span>
|
166
|
+
{% endif %}
|
167
|
+
</div>
|
168
|
+
{% endraw %}
|
169
|
+
{% endhighlight %}
|
170
|
+
|
171
|
+
<div class="note warning">
|
172
|
+
<h5>Beware the page one edge-case</h5>
|
173
|
+
<p>
|
174
|
+
Jekyll does not generate a ‘page1’ folder, so the above code will not work
|
175
|
+
when a <code>/page1</code> link is produced. See below for a way to handle
|
176
|
+
this if it’s a problem for you.
|
177
|
+
</p>
|
178
|
+
</div>
|
179
|
+
|
180
|
+
The following HTML snippet should handle page one, and render a list of each
|
181
|
+
page with links to all but the current page.
|
182
|
+
|
183
|
+
{% highlight html %}
|
184
|
+
{% raw %}
|
185
|
+
{% if paginator.total_pages > 1 %}
|
186
|
+
<div class="pagination">
|
187
|
+
{% if paginator.previous_page %}
|
188
|
+
<a href="{{ paginator.previous_page_path | prepend: site.baseurl | replace: '//', '/' }}">« Prev</a>
|
189
|
+
{% else %}
|
190
|
+
<span>« Prev</span>
|
191
|
+
{% endif %}
|
192
|
+
|
193
|
+
{% for page in (1..paginator.total_pages) %}
|
194
|
+
{% if page == paginator.page %}
|
195
|
+
<em>{{ page }}</em>
|
196
|
+
{% elsif page == 1 %}
|
197
|
+
<a href="{{ '/index.html' | prepend: site.baseurl | replace: '//', '/' }}">{{ page }}</a>
|
198
|
+
{% else %}
|
199
|
+
<a href="{{ site.paginate_path | prepend: site.baseurl | replace: '//', '/' | replace: ':num', page }}">{{ page }}</a>
|
200
|
+
{% endif %}
|
201
|
+
{% endfor %}
|
202
|
+
|
203
|
+
{% if paginator.next_page %}
|
204
|
+
<a href="{{ paginator.next_page_path | prepend: site.baseurl | replace: '//', '/' }}">Next »</a>
|
205
|
+
{% else %}
|
206
|
+
<span>Next »</span>
|
207
|
+
{% endif %}
|
208
|
+
</div>
|
209
|
+
{% endif %}
|
210
|
+
{% endraw %}
|
211
|
+
{% endhighlight %}
|
@@ -0,0 +1,180 @@
|
|
1
|
+
---
|
2
|
+
layout: docs
|
3
|
+
title: Permalinks
|
4
|
+
prev_section: templates
|
5
|
+
next_section: pagination
|
6
|
+
permalink: /docs/permalinks/
|
7
|
+
---
|
8
|
+
|
9
|
+
Jekyll supports a flexible way to build your site’s URLs. You can specify the
|
10
|
+
permalinks for your site through the [Configuration](../configuration/) or in the
|
11
|
+
[YAML Front Matter](../frontmatter/) for each post. You’re free to choose one of
|
12
|
+
the built-in styles to create your links or craft your own. The default style is
|
13
|
+
`date`.
|
14
|
+
|
15
|
+
Permalinks are constructed by creating a template URL where dynamic elements are
|
16
|
+
represented by colon-prefixed keywords. For example, the default `date`
|
17
|
+
permalink is defined as `/:categories/:year/:month/:day/:title.html`.
|
18
|
+
|
19
|
+
## Template variables
|
20
|
+
|
21
|
+
<div class="mobile-side-scroller">
|
22
|
+
<table>
|
23
|
+
<thead>
|
24
|
+
<tr>
|
25
|
+
<th>Variable</th>
|
26
|
+
<th>Description</th>
|
27
|
+
</tr>
|
28
|
+
</thead>
|
29
|
+
<tbody>
|
30
|
+
<tr>
|
31
|
+
<td>
|
32
|
+
<p><code>year</code></p>
|
33
|
+
</td>
|
34
|
+
<td>
|
35
|
+
<p>Year from the Post’s filename</p>
|
36
|
+
</td>
|
37
|
+
</tr>
|
38
|
+
<tr>
|
39
|
+
<td>
|
40
|
+
<p><code>month</code></p>
|
41
|
+
</td>
|
42
|
+
<td>
|
43
|
+
<p>Month from the Post’s filename</p>
|
44
|
+
</td>
|
45
|
+
</tr>
|
46
|
+
<tr>
|
47
|
+
<td>
|
48
|
+
<p><code>i_month</code></p>
|
49
|
+
</td>
|
50
|
+
<td>
|
51
|
+
<p>Month from the Post’s filename without leading zeros.</p>
|
52
|
+
</td>
|
53
|
+
</tr>
|
54
|
+
<tr>
|
55
|
+
<td>
|
56
|
+
<p><code>day</code></p>
|
57
|
+
</td>
|
58
|
+
<td>
|
59
|
+
<p>Day from the Post’s filename</p>
|
60
|
+
</td>
|
61
|
+
</tr>
|
62
|
+
<tr>
|
63
|
+
<td>
|
64
|
+
<p><code>i_day</code></p>
|
65
|
+
</td>
|
66
|
+
<td>
|
67
|
+
<p>Day from the Post’s filename without leading zeros.</p>
|
68
|
+
</td>
|
69
|
+
</tr>
|
70
|
+
<tr>
|
71
|
+
<td>
|
72
|
+
<p><code>title</code></p>
|
73
|
+
</td>
|
74
|
+
<td>
|
75
|
+
<p>Title from the Post’s filename</p>
|
76
|
+
</td>
|
77
|
+
</tr>
|
78
|
+
<tr>
|
79
|
+
<td>
|
80
|
+
<p><code>categories</code></p>
|
81
|
+
</td>
|
82
|
+
<td>
|
83
|
+
<p>
|
84
|
+
The specified categories for this Post. Jekyll automatically parses
|
85
|
+
out double slashes in the URLs, so if no categories are present, it
|
86
|
+
will ignore this.
|
87
|
+
</p>
|
88
|
+
</td>
|
89
|
+
</tr>
|
90
|
+
</tbody>
|
91
|
+
</table>
|
92
|
+
</div>
|
93
|
+
|
94
|
+
## Built-in permalink styles
|
95
|
+
|
96
|
+
<div class="mobile-side-scroller">
|
97
|
+
<table>
|
98
|
+
<thead>
|
99
|
+
<tr>
|
100
|
+
<th>Permalink Style</th>
|
101
|
+
<th>URL Template</th>
|
102
|
+
</tr>
|
103
|
+
</thead>
|
104
|
+
<tbody>
|
105
|
+
<tr>
|
106
|
+
<td>
|
107
|
+
<p><code>date</code></p>
|
108
|
+
</td>
|
109
|
+
<td>
|
110
|
+
<p><code>/:categories/:year/:month/:day/:title.html</code></p>
|
111
|
+
</td>
|
112
|
+
</tr>
|
113
|
+
<tr>
|
114
|
+
<td>
|
115
|
+
<p><code>pretty</code></p>
|
116
|
+
</td>
|
117
|
+
<td>
|
118
|
+
<p><code>/:categories/:year/:month/:day/:title/</code></p>
|
119
|
+
</td>
|
120
|
+
</tr>
|
121
|
+
<tr>
|
122
|
+
<td>
|
123
|
+
<p><code>none</code></p>
|
124
|
+
</td>
|
125
|
+
<td>
|
126
|
+
<p><code>/:categories/:title.html</code></p>
|
127
|
+
</td>
|
128
|
+
</tr>
|
129
|
+
</tbody>
|
130
|
+
</table>
|
131
|
+
</div>
|
132
|
+
|
133
|
+
## Permalink style examples
|
134
|
+
|
135
|
+
Given a post named: `/2009-04-29-slap-chop.textile`
|
136
|
+
|
137
|
+
<div class="mobile-side-scroller">
|
138
|
+
<table>
|
139
|
+
<thead>
|
140
|
+
<tr>
|
141
|
+
<th>Permalink Setting</th>
|
142
|
+
<th>Resulting Permalink URL</th>
|
143
|
+
</tr>
|
144
|
+
</thead>
|
145
|
+
<tbody>
|
146
|
+
<tr>
|
147
|
+
<td>
|
148
|
+
<p>None specified, or <code>permalink: date</code></p>
|
149
|
+
</td>
|
150
|
+
<td>
|
151
|
+
<p><code>/2009/04/29/slap-chop.html</code></p>
|
152
|
+
</td>
|
153
|
+
</tr>
|
154
|
+
<tr>
|
155
|
+
<td>
|
156
|
+
<p><code>permalink: pretty</code></p>
|
157
|
+
</td>
|
158
|
+
<td>
|
159
|
+
<p><code>/2009/04/29/slap-chop/index.html</code></p>
|
160
|
+
</td>
|
161
|
+
</tr>
|
162
|
+
<tr>
|
163
|
+
<td>
|
164
|
+
<p><code>permalink: /:month-:day-:year/:title.html</code></p>
|
165
|
+
</td>
|
166
|
+
<td>
|
167
|
+
<p><code>/04-29-2009/slap-chop.html</code></p>
|
168
|
+
</td>
|
169
|
+
</tr>
|
170
|
+
<tr>
|
171
|
+
<td>
|
172
|
+
<p><code>permalink: /blog/:year/:month/:day/:title</code></p>
|
173
|
+
</td>
|
174
|
+
<td>
|
175
|
+
<p><code>/blog/2009/04/29/slap-chop/index.html</code></p>
|
176
|
+
</td>
|
177
|
+
</tr>
|
178
|
+
</tbody>
|
179
|
+
</table>
|
180
|
+
</div>
|