jekyll 0.12.1 → 1.0.0.beta1
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of jekyll might be problematic. Click here for more details.
- data/CONTRIBUTING.md +67 -0
- data/Gemfile +1 -1
- data/History.txt +50 -6
- data/README.textile +10 -6
- data/Rakefile +74 -36
- data/bin/jekyll +78 -276
- data/cucumber.yml +3 -1
- data/features/create_sites.feature +1 -1
- data/features/drafts.feature +25 -0
- data/features/site_configuration.feature +1 -1
- data/features/step_definitions/jekyll_steps.rb +13 -3
- data/features/support/env.rb +3 -1
- data/jekyll.gemspec +73 -17
- data/lib/jekyll.rb +31 -21
- data/lib/jekyll/command.rb +12 -0
- data/lib/jekyll/commands/build.rb +81 -0
- data/lib/jekyll/commands/serve.rb +28 -0
- data/lib/jekyll/converter.rb +1 -3
- data/lib/jekyll/converters/identity.rb +13 -14
- data/lib/jekyll/converters/markdown.rb +128 -128
- data/lib/jekyll/converters/textile.rb +37 -37
- data/lib/jekyll/convertible.rb +6 -4
- data/lib/jekyll/core_ext.rb +9 -1
- data/lib/jekyll/draft.rb +35 -0
- data/lib/jekyll/errors.rb +1 -3
- data/lib/jekyll/filters.rb +13 -4
- data/lib/jekyll/generator.rb +1 -4
- data/lib/jekyll/generators/pagination.rb +46 -46
- data/lib/jekyll/layout.rb +0 -2
- data/lib/jekyll/mime.types +1588 -0
- data/lib/jekyll/page.rb +24 -8
- data/lib/jekyll/plugin.rb +0 -2
- data/lib/jekyll/post.rb +66 -40
- data/lib/jekyll/site.rb +96 -20
- data/lib/jekyll/static_file.rb +0 -2
- data/lib/jekyll/tags/gist.rb +19 -0
- data/lib/jekyll/tags/highlight.rb +63 -62
- data/lib/jekyll/tags/include.rb +25 -25
- data/lib/jekyll/tags/post_url.rb +30 -25
- data/script/bootstrap +2 -0
- data/site/.gitignore +4 -0
- data/site/CNAME +1 -0
- data/site/README +1 -0
- data/site/_config.yml +5 -0
- data/site/_includes/analytics.html +32 -0
- data/site/_includes/docs_contents.html +82 -0
- data/site/_includes/footer.html +15 -0
- data/site/_includes/header.html +26 -0
- data/site/_includes/section_nav.html +22 -0
- data/site/_includes/top.html +14 -0
- data/site/_layouts/default.html +12 -0
- data/site/_layouts/docs.html +21 -0
- data/site/_posts/2012-07-01-configuration.md +277 -0
- data/site/_posts/2012-07-01-contributing.md +66 -0
- data/site/_posts/2012-07-01-deployment-methods.md +108 -0
- data/site/_posts/2012-07-01-extras.md +103 -0
- data/site/_posts/2012-07-01-frontmatter.md +120 -0
- data/site/_posts/2012-07-01-github-pages.md +34 -0
- data/site/_posts/2012-07-01-heroku.md +8 -0
- data/site/_posts/2012-07-01-home.md +47 -0
- data/site/_posts/2012-07-01-installation.md +43 -0
- data/site/_posts/2012-07-01-migrations.md +180 -0
- data/site/_posts/2012-07-01-pages.md +62 -0
- data/site/_posts/2012-07-01-pagination.md +116 -0
- data/site/_posts/2012-07-01-permalinks.md +163 -0
- data/site/_posts/2012-07-01-plugins.md +384 -0
- data/site/_posts/2012-07-01-posts.md +106 -0
- data/site/_posts/2012-07-01-resources.md +49 -0
- data/site/_posts/2012-07-01-sites.md +28 -0
- data/site/_posts/2012-07-01-structure.md +95 -0
- data/site/_posts/2012-07-01-templates.md +217 -0
- data/site/_posts/2012-07-01-troubleshooting.md +108 -0
- data/site/_posts/2012-07-01-usage.md +38 -0
- data/site/_posts/2012-07-01-variables.md +166 -0
- data/site/css/grid.css +62 -0
- data/site/css/normalize.css +504 -0
- data/site/css/pygments.css +70 -0
- data/site/css/style.css +697 -0
- data/site/docs/index.html +11 -0
- data/site/favicon.png +0 -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 +77 -0
- data/site/js/modernizr-2.5.3.min.js +4 -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/helper.rb +16 -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/contacts/bar.html +5 -0
- data/test/source/contacts/index.html +5 -0
- data/test/test_configuration.rb +7 -8
- data/test/test_convertible.rb +29 -0
- data/test/test_core_ext.rb +22 -0
- data/test/test_generated_site.rb +1 -1
- data/test/test_kramdown.rb +3 -3
- data/test/test_page.rb +88 -2
- data/test/test_post.rb +42 -6
- data/test/test_rdiscount.rb +1 -1
- data/test/test_redcarpet.rb +1 -1
- data/test/test_redcloth.rb +6 -6
- data/test/test_site.rb +73 -8
- data/test/test_tags.rb +36 -13
- metadata +150 -19
- data/lib/jekyll/migrators/csv.rb +0 -26
- data/lib/jekyll/migrators/drupal.rb +0 -103
- data/lib/jekyll/migrators/enki.rb +0 -49
- data/lib/jekyll/migrators/joomla.rb +0 -53
- data/lib/jekyll/migrators/marley.rb +0 -52
- data/lib/jekyll/migrators/mephisto.rb +0 -84
- data/lib/jekyll/migrators/mt.rb +0 -86
- data/lib/jekyll/migrators/posterous.rb +0 -67
- data/lib/jekyll/migrators/rss.rb +0 -47
- data/lib/jekyll/migrators/textpattern.rb +0 -58
- data/lib/jekyll/migrators/tumblr.rb +0 -195
- data/lib/jekyll/migrators/typo.rb +0 -51
- data/lib/jekyll/migrators/wordpress.rb +0 -294
- data/lib/jekyll/migrators/wordpressdotcom.rb +0 -70
@@ -0,0 +1,384 @@
|
|
1
|
+
---
|
2
|
+
layout: docs
|
3
|
+
title: Plugins
|
4
|
+
prev_section: assets
|
5
|
+
next_section: extras
|
6
|
+
---
|
7
|
+
|
8
|
+
Jekyll has a plugin system with hooks that allow you to create custom generated
|
9
|
+
content specific to your site. You can run custom code for your site
|
10
|
+
without having to modify the Jekyll source itself.
|
11
|
+
|
12
|
+
<div class="note info">
|
13
|
+
<h5>Plugins on GitHub Pages</h5>
|
14
|
+
<p>GitHub Pages are powered by Jekyll, however all Pages sites are generated using the <code>--safe</code> option to disable custom plugins for security reasons. Unfortunately, this means your plugins won’t work if you’re deploying to GitHub Pages.</p>
|
15
|
+
</div>
|
16
|
+
|
17
|
+
## Installing a plugin
|
18
|
+
|
19
|
+
In your site source root, make a `_plugins` directory. Place your plugins
|
20
|
+
here. Any file ending in `*.rb` inside this directory will be required
|
21
|
+
when Jekyll generates your site.
|
22
|
+
|
23
|
+
In general, plugins you make will fall into one of three categories:
|
24
|
+
|
25
|
+
1. Generators
|
26
|
+
2. Converters
|
27
|
+
3. Tags
|
28
|
+
|
29
|
+
## Generators
|
30
|
+
|
31
|
+
You can create a generator when you need Jekyll to create additional
|
32
|
+
content based on your own rules. For example, a generator might look
|
33
|
+
like this:
|
34
|
+
|
35
|
+
{% highlight ruby %}
|
36
|
+
module Jekyll
|
37
|
+
|
38
|
+
class CategoryPage < Page
|
39
|
+
def initialize(site, base, dir, category)
|
40
|
+
@site = site
|
41
|
+
@base = base
|
42
|
+
@dir = dir
|
43
|
+
@name = 'index.html'
|
44
|
+
|
45
|
+
self.process(@name)
|
46
|
+
self.read_yaml(File.join(base, '_layouts'), 'category_index.html')
|
47
|
+
self.data['category'] = category
|
48
|
+
|
49
|
+
category_title_prefix = site.config['category_title_prefix'] || 'Category: '
|
50
|
+
self.data['title'] = "#{category_title_prefix}#{category}"
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
class CategoryPageGenerator < Generator
|
55
|
+
safe true
|
56
|
+
|
57
|
+
def generate(site)
|
58
|
+
if site.layouts.key? 'category_index'
|
59
|
+
dir = site.config['category_dir'] || 'categories'
|
60
|
+
site.categories.keys.each do |category|
|
61
|
+
site.pages << CategoryPage.new(site, site.source, File.join(dir, category), category)
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
end
|
68
|
+
{% endhighlight %}
|
69
|
+
|
70
|
+
In this example, our generator will create a series of files under the
|
71
|
+
`categories` directory for each category, listing the posts in each
|
72
|
+
category using the `category_index.html` layout.
|
73
|
+
|
74
|
+
Generators are only required to implement one method:
|
75
|
+
|
76
|
+
<table>
|
77
|
+
<thead>
|
78
|
+
<tr>
|
79
|
+
<th>Method</th>
|
80
|
+
<th>Description</th>
|
81
|
+
</tr>
|
82
|
+
</thead>
|
83
|
+
<tbody>
|
84
|
+
<tr>
|
85
|
+
<td>
|
86
|
+
<p><code>generate</code></p>
|
87
|
+
</td>
|
88
|
+
<td>
|
89
|
+
<p>String output of the content being generated.</p>
|
90
|
+
</td>
|
91
|
+
</tr>
|
92
|
+
</tbody>
|
93
|
+
</table>
|
94
|
+
|
95
|
+
## Converters
|
96
|
+
|
97
|
+
If you have a new markup language you’d like to include in your site,
|
98
|
+
you can include it by implementing your own converter. Both the markdown
|
99
|
+
and textile markup languages are implemented using this method.
|
100
|
+
|
101
|
+
<div class="note info">
|
102
|
+
<h5>Remember your YAML front-matter</h5>
|
103
|
+
<p>Jekyll will only convert files that have a YAML header at
|
104
|
+
the top, even for converters you add using a plugin. If there is no YAML header, Jekyll will ignore the file and not send it through the converter.</p>
|
105
|
+
</div>
|
106
|
+
|
107
|
+
Below is a converter that will take all posts ending in .upcase and
|
108
|
+
process them using the UpcaseConverter:
|
109
|
+
|
110
|
+
{% highlight ruby %}
|
111
|
+
module Jekyll
|
112
|
+
class UpcaseConverter < Converter
|
113
|
+
safe true
|
114
|
+
priority :low
|
115
|
+
|
116
|
+
def matches(ext)
|
117
|
+
ext =~ /upcase/i
|
118
|
+
end
|
119
|
+
|
120
|
+
def output_ext(ext)
|
121
|
+
".html"
|
122
|
+
end
|
123
|
+
|
124
|
+
def convert(content)
|
125
|
+
content.upcase
|
126
|
+
end
|
127
|
+
end
|
128
|
+
end
|
129
|
+
{% endhighlight %}
|
130
|
+
|
131
|
+
Converters should implement at a minimum 3 methods:
|
132
|
+
|
133
|
+
<table>
|
134
|
+
<thead>
|
135
|
+
<tr>
|
136
|
+
<th>Method</th>
|
137
|
+
<th>Description</th>
|
138
|
+
</tr>
|
139
|
+
</thead>
|
140
|
+
<tbody>
|
141
|
+
<tr>
|
142
|
+
<td>
|
143
|
+
<p><code>matches</code></p>
|
144
|
+
</td>
|
145
|
+
<td>
|
146
|
+
<p>Called to determine whether the specific converter will
|
147
|
+
run on the page.</p>
|
148
|
+
</td>
|
149
|
+
</tr>
|
150
|
+
<tr>
|
151
|
+
<td>
|
152
|
+
<p><code>output_ext</code></p>
|
153
|
+
</td>
|
154
|
+
<td>
|
155
|
+
<p>The extension of the outputted file, usually this will be <code>.html</code></p>
|
156
|
+
</td>
|
157
|
+
</tr>
|
158
|
+
<tr>
|
159
|
+
<td>
|
160
|
+
<p><code>convert</code></p>
|
161
|
+
</td>
|
162
|
+
<td>
|
163
|
+
<p>Logic to do the content conversion</p>
|
164
|
+
</td>
|
165
|
+
</tr>
|
166
|
+
</tbody>
|
167
|
+
</table>
|
168
|
+
|
169
|
+
In our example, UpcaseConverter-matches checks if our filename extension is `.upcase`, and will render using the converter if it is. It will call UpcaseConverter-convert to process the content - in our simple converter we’re simply capitalizing the entire content string. Finally, when it saves the page, it will do so with the `.html` extension.
|
170
|
+
|
171
|
+
## Tags
|
172
|
+
|
173
|
+
If you’d like to include custom liquid tags in your site, you can do so
|
174
|
+
by hooking into the tagging system. Built-in examples added by Jekyll
|
175
|
+
include the `{{"{% highlight "}}%}` and `{{"{% include "}}%}` tags. Below is an example custom liquid tag that will output the time the page was rendered:
|
176
|
+
|
177
|
+
{% highlight ruby %}
|
178
|
+
module Jekyll
|
179
|
+
class RenderTimeTag < Liquid::Tag
|
180
|
+
|
181
|
+
def initialize(tag_name, text, tokens)
|
182
|
+
super
|
183
|
+
@text = text
|
184
|
+
end
|
185
|
+
|
186
|
+
def render(context)
|
187
|
+
"#{@text} #{Time.now}"
|
188
|
+
end
|
189
|
+
end
|
190
|
+
end
|
191
|
+
|
192
|
+
Liquid::Template.register_tag('render_time', Jekyll::RenderTimeTag)
|
193
|
+
{% endhighlight %}
|
194
|
+
|
195
|
+
At a minimum, liquid tags must implement:
|
196
|
+
|
197
|
+
<table>
|
198
|
+
<thead>
|
199
|
+
<tr>
|
200
|
+
<th>Method</th>
|
201
|
+
<th>Description</th>
|
202
|
+
</tr>
|
203
|
+
</thead>
|
204
|
+
<tbody>
|
205
|
+
<tr>
|
206
|
+
<td>
|
207
|
+
<p><code>render</code></p>
|
208
|
+
</td>
|
209
|
+
<td>
|
210
|
+
<p>Outputs the content of the tag.</p>
|
211
|
+
</td>
|
212
|
+
</tr>
|
213
|
+
</tbody>
|
214
|
+
</table>
|
215
|
+
|
216
|
+
You must also register the custom tag with the Liquid template engine as follows:
|
217
|
+
|
218
|
+
{% highlight ruby %}
|
219
|
+
Liquid::Template.register_tag('render_time', Jekyll::RenderTimeTag)
|
220
|
+
{% endhighlight %}
|
221
|
+
|
222
|
+
In the example above, we can place the following tag anywhere in one of our pages:
|
223
|
+
|
224
|
+
{% highlight ruby %}
|
225
|
+
<p>{{"{% render_time page rendered at: "}}%}</p>
|
226
|
+
{% endhighlight %}
|
227
|
+
|
228
|
+
And we would get something like this on the page:
|
229
|
+
|
230
|
+
{% highlight html %}
|
231
|
+
<p>page rendered at: Tue June 22 23:38:47 –0500 2010</p>
|
232
|
+
{% endhighlight %}
|
233
|
+
|
234
|
+
### Liquid filters
|
235
|
+
|
236
|
+
You can add your own filters to the Liquid template system much like you can add tags above. Filters are simply modules that export their methods to liquid. All methods will have to take at least one parameter which represents the input of the filter. The return value will be the output of the filter.
|
237
|
+
|
238
|
+
{% highlight ruby %}
|
239
|
+
module Jekyll
|
240
|
+
module AssetFilter
|
241
|
+
def asset_url(input)
|
242
|
+
"http://www.example.com/#{input}?#{Time.now.to_i}"
|
243
|
+
end
|
244
|
+
end
|
245
|
+
end
|
246
|
+
|
247
|
+
Liquid::Template.register_filter(Jekyll::AssetFilter)
|
248
|
+
{% endhighlight %}
|
249
|
+
|
250
|
+
<div class="note">
|
251
|
+
<h5>ProTip™: Access the site object using Liquid</h5>
|
252
|
+
<p>Jekyll lets you access the <code>site</code> object through the <code>context.registers</code> feature of liquid. For example, you can access the global configuration file <code>_config.yml</code> using <code>context.registers.config</code>.</p>
|
253
|
+
</div>
|
254
|
+
|
255
|
+
### Flags
|
256
|
+
|
257
|
+
There are two flags to be aware of when writing a plugin:
|
258
|
+
|
259
|
+
<table>
|
260
|
+
<thead>
|
261
|
+
<tr>
|
262
|
+
<th>Flag</th>
|
263
|
+
<th>Description</th>
|
264
|
+
</tr>
|
265
|
+
</thead>
|
266
|
+
<tbody>
|
267
|
+
<tr>
|
268
|
+
<td>
|
269
|
+
<p><code>safe</code></p>
|
270
|
+
</td>
|
271
|
+
<td>
|
272
|
+
<p>A boolean flag that allows a plugin to be safely included in
|
273
|
+
Jekyll core for exclusion from use with GitHub Pages. In general, set
|
274
|
+
this to <code>true</code>.</p>
|
275
|
+
</td>
|
276
|
+
</tr>
|
277
|
+
<tr>
|
278
|
+
<td>
|
279
|
+
<p><code>priortiy</code></p>
|
280
|
+
</td>
|
281
|
+
<td>
|
282
|
+
<p>This flag determines what order the plugin is loaded in. Valid
|
283
|
+
values are: <code>:lowest</code>, <code>:low</code>, <code>:normal</code>, <code>:high</code>, and <code>:highest</code>.</p>
|
284
|
+
</td>
|
285
|
+
</tr>
|
286
|
+
</tbody>
|
287
|
+
</table>
|
288
|
+
|
289
|
+
To use one of the example plugins above as an illustration, here is how you’d specify these two flags:
|
290
|
+
|
291
|
+
{% highlight ruby %}
|
292
|
+
module Jekyll
|
293
|
+
class UpcaseConverter < Converter
|
294
|
+
safe true
|
295
|
+
priority :low
|
296
|
+
...
|
297
|
+
end
|
298
|
+
end
|
299
|
+
{% endhighlight %}
|
300
|
+
|
301
|
+
|
302
|
+
## Available Plugins
|
303
|
+
|
304
|
+
There are a few useful, prebuilt plugins at the following locations:
|
305
|
+
|
306
|
+
- [Truncate HTML while preserving markup structure](https://github.com/MattHall/truncatehtml) by [Matt Hall](http://codebeef.com)
|
307
|
+
- [Generic Blog Plugins by Jose Diaz-Gonzalez](https://github.com/josegonzalez/josediazgonzalez.com/tree/master/_plugins): Contains plugins for tags, categories, archives, as well as a few liquid extensions
|
308
|
+
- [Domain Name Filter by Lawrence Woodman](https://github.com/LawrenceWoodman/domain_name-liquid_filter): Filters the input text so that just the domain name is left
|
309
|
+
- [Jekyll Plugins by Recursive Design](http://recursive-design.com/projects/jekyll-plugins/): Plugin to generate Project pages from github readmes, a Category page plugin, and a Sitemap generator
|
310
|
+
- [Tag Cloud Plugin from a Jekyll walk-through](http://vitobotta.com/how-to-migrate-from-wordpress-to-jekyll/): Plugin to generate a Tag Cloud
|
311
|
+
- [Pygments Cache Path by Raimonds Simanovskis](https://github.com/rsim/blog.rayapps.com/blob/master/_plugins/pygments_cache_patch.rb): Plugin to cache syntax-highlighted code from Pygments
|
312
|
+
- [Delicious Plugin by Christian Hellsten](https://github.com/christianhellsten/jekyll-plugins): Fetches and renders bookmarks from delicious.com.
|
313
|
+
- [Ultraviolet plugin by Steve Alex](https://gist.github.com/480380): Jekyll Plugin for Ultraviolet
|
314
|
+
- [HAML plugin by Sam Z](https://gist.github.com/517556): HAML plugin for jekyll
|
315
|
+
- [ArchiveGenerator by Ilkka Laukkanen](https://gist.github.com/707909): Uses [this archive page](https://gist.github.com/707020) to generate archives
|
316
|
+
- [Tag Cloud Plugin by Ilkka Laukkanen](https://gist.github.com/710577): Jekyll tag cloud / tag pages plugin
|
317
|
+
- [HAML/SASS Converter by Adam Pearson](https://gist.github.com/481456): Simple haml-sass conversion for jekyll. [Fork](https://gist.github.com/528642) by Sam X
|
318
|
+
- [SASS scss Converter by Mark Wolfe](https://gist.github.com/960150): Jekyll Converter which uses the new css compatible syntax, based on the one written by Sam X.
|
319
|
+
- [GIT Tag by Alexandre Girard](https://gist.github.com/730347): Jekyll plugin to add Git activity inside a list
|
320
|
+
- [Draft/Publish Plugin by Michael Ivey](https://gist.github.com/49630)
|
321
|
+
- [Less.js generator by Andy Fowler](https://gist.github.com/642739): Jekyll plugin to render less.js files during generation.
|
322
|
+
- [Less Converter by Jason Graham](https://gist.github.com/639920): A Jekyll plugin to convert a .less file to .css
|
323
|
+
- [Less Converter by Josh Brown](https://gist.github.com/760265)
|
324
|
+
|
325
|
+
- [MathJax Liquid Tags by Jessy Cowan-Sharp](https://gist.github.com/834610): A simple liquid tag for Jekyll that converts and into inline math, and and into block equations, by replacing with the appropriate MathJax script tags.
|
326
|
+
- [Non-JS Gist Tag by Brandon Tilley](https://gist.github.com/1027674) A Liquid tag for Jekyll sites that allows embedding Gists and showing code for non-JavaScript enabled browsers and readers.
|
327
|
+
- [Growl Notification Generator by Tate Johnson](https://gist.github.com/490101)
|
328
|
+
- [Growl Notification Hook by Tate Johnson](https://gist.github.com/525267): Better alternative to the above, but requires his “hook” fork.
|
329
|
+
- [Version Reporter by Blake Smith](https://gist.github.com/449491)
|
330
|
+
- [Upcase Converter by Blake Smith](https://gist.github.com/449463)
|
331
|
+
- [Render Time Tag by Blake Smith](https://gist.github.com/449509)
|
332
|
+
- [Summarize Filter by Mathieu Arnold](https://gist.github.com/731597)
|
333
|
+
- [Status.net/OStatus Tag by phaer](https://gist.github.com/912466)
|
334
|
+
- [CoffeeScript converter by phaer](https://gist.github.com/959938): Put this file in `plugins` and write a YAML header to your .coffee files. See [http://coffeescript.org](http://coffeescript.org) for more info
|
335
|
+
- [Raw Tag by phaer.](https://gist.github.com/1020852): Keeps liquid from parsing text betweeen `{{ "{% raw " }}%}` and `{{ "{% endraw " }}%}`
|
336
|
+
- [URL encoding by James An](https://gist.github.com/919275)
|
337
|
+
- [Sitemap.xml Generator by Michael Levin](http://www.kinnetica.com/projects/jekyll-sitemap-generator/)
|
338
|
+
- [Markdown references by Olov Lassus](https://gist.github.com/961336): Keep all your markdown reference-style link definitions in one file (_references.md)
|
339
|
+
- [Full-text search by Pascal Widdershoven](https://github.com/PascalW/jekyll_indextank): Add full-text search to your Jekyll site with this plugin and a bit of JavaScript.
|
340
|
+
- [Stylus Converter](https://gist.github.com/988201) Convert .styl to .css.
|
341
|
+
- [Embed.ly client by Robert Böhnke](https://github.com/robb/jekyll-embedly-client) Autogenerate embeds from URLs using oEmbed.
|
342
|
+
- [Logarithmic Tag Cloud](https://gist.github.com/2290195): Flexible. Logarithmic distribution. Usage eg: `{{ "{% tag_cloud font-size: 50 - 150%, threshold: 2 " }}%}`. Documentation inline.
|
343
|
+
- [Related Posts by Lawrence Woodman](https://github.com/LawrenceWoodman/related_posts-jekyll_plugin): Overrides `site.related_posts` to use categories to assess relationship
|
344
|
+
- [AliasGenerator by Thomas Mango](https://github.com/tsmango/jekyll_alias_generator): Generates redirect pages for posts when an alias configuration is specified in the YAML Front Matter.
|
345
|
+
- [FlickrSetTag by Thomas Mango](https://github.com/tsmango/jekyll_flickr_set_tag): Generates image galleries from Flickr sets.
|
346
|
+
- [Projectlist by Frederic Hemberger](https://github.com/fhemberger/jekyll-projectlist): Loads all files from a directory and renders the entries into a single page, instead of creating separate posts.
|
347
|
+
- [Tiered Archives by Eli Naeher](https://gist.github.com/88cda643aa7e3b0ca1e5): creates a tiered template variable that allows you to create archives grouped by year and month.
|
348
|
+
- [Jammit generator by Vladimir Andrijevik](https://gist.github.com/1224971): enables use of [Jammit](http://documentcloud.github.com/jammit/) for JavaScript and CSS packaging.
|
349
|
+
- [oEmbed Tag by Tammo van Lessen](https://gist.github.com/1455726): enables easy content embedding (e.g. from YouTube, Flickr, Slideshare) via oEmbed.
|
350
|
+
- [Company website and blog plugins](https://github.com/flatterline/jekyll-plugins) by Flatterline, a [Ruby on Rails development company](http://flatterline.com/): portfolio/project page generator, team/individual page generator, author bio liquid template tag for use on posts and a few other smaller plugins.
|
351
|
+
- [Transform Layouts](https://gist.github.com/1472645) Monkey patching allowing HAML layouts (you need a HAML Converter plugin for this to work)
|
352
|
+
- [ReStructuredText converter](https://github.com/xdissent/jekyll-rst): Converts ReST documents to HTML with Pygments syntax highlighting.
|
353
|
+
- [Tweet Tag by Scott W. Bradley](https://github.com/scottwb/jekyll-tweet-tag): Liquid tag for [Embedded Tweets](https://dev.twitter.com/docs/embedded-tweets) using Twitter’s shortcodes
|
354
|
+
- [jekyll-localization](https://github.com/blackwinter/jekyll-localization): Jekyll plugin that adds localization features to the rendering engine.
|
355
|
+
- [jekyll-rendering](https://github.com/blackwinter/jekyll-rendering): Jekyll plugin to provide alternative rendering engines.
|
356
|
+
- [jekyll-pagination](https://github.com/blackwinter/jekyll-pagination): Jekyll plugin to extend the pagination generator.
|
357
|
+
- [jekyll-tagging](https://github.com/pattex/jekyll-tagging): Jekyll plugin to automatically generate a tag cloud and tag pages.
|
358
|
+
- [Generate YouTube Embed (tag)](https://gist.github.com/1805814) by [joelverhagen](https://github.com/joelverhagen): Jekyll plugin which allows you to embed a YouTube video in your page with the YouTube ID. Optionally specify width and height dimensions. Like “oEmbed Tag” but just for YouTube.
|
359
|
+
- [JSON Filter](https://gist.github.com/1850654) by [joelverhagen](https://github.com/joelverhagen): filter that takes input text and outputs it as JSON. Great for rendering JavaScript.
|
360
|
+
- [jekyll-beastiepress](https://github.com/okeeblow/jekyll-beastiepress): FreeBSD utility tags for Jekyll sites.
|
361
|
+
- [jsonball](https://gist.github.com/1895282): reads json files and produces maps for use in jekylled files
|
362
|
+
- [redcarpet2](https://github.com/nono/Jekyll-plugins): use Redcarpet2 for rendering markdown
|
363
|
+
- [bibjekyll](https://github.com/pablooliveira/bibjekyll): render BibTeX-formatted bibliographies/citations included in posts/pages using bibtex2html
|
364
|
+
- [jekyll-citation](https://github.com/archome/jekyll-citation): render BibTeX-formatted bibliographies/citations included in posts/pages (pure Ruby)
|
365
|
+
- [jekyll-scholar](https://github.com/inukshuk/jekyll-scholar): Jekyll extensions for the blogging scholar
|
366
|
+
- [jekyll-asset_bundler](https://github.com/moshen/jekyll-asset_bundler): bundles and minifies JavaScript and CSS
|
367
|
+
- [Jekyll Dribbble Set Tag](https://github.com/ericdfields/Jekyll-Dribbble-Set-Tag): builds Dribbble image galleries from any user
|
368
|
+
- [debbugs](https://gist.github.com/2218470): allows posting links to Debian BTS easily
|
369
|
+
- [refheap_tag](https://github.com/aburdette/refheap_tag): Liquid tag that allows embedding pastes from [refheap](https://refheap.com)
|
370
|
+
- [i18n_filter](https://github.com/gacha/gacha.id.lv/blob/master/_plugins/i18n_filter.rb): Liquid filter to use I18n localization.
|
371
|
+
- [singlepage-jekyll](https://github.com/JCB-K/singlepage-jekyll) by [JCB-K](https://github.com/JCB-K): turns Jekyll into a dynamic one-page website.
|
372
|
+
- [flickr](http://jonasforsberg.se/2012/04/15/flickr-plugin-for-jekyll/): Embed photos from flickr right into your posts.
|
373
|
+
- [jekyll-devonly_tag](https://gist.github.com/2403522): A block tag for including markup only during development.
|
374
|
+
- [Jekyll plugins by Aucor](https://github.com/aucor/jekyll-plugins): Plugins for eg. trimming unwanted newlines/whitespace and sorting pages by weight attribute.
|
375
|
+
- [Only first paragraph](https://github.com/sebcioz/jekyll-only_first_p): Show only first paragrpaph of page/post.
|
376
|
+
- [jekyll-pandoc-plugin](https://github.com/dsanson/jekyll-pandoc-plugin): use pandoc for rendering markdown.
|
377
|
+
- [File compressor](https://gist.github.com/2758691) by [mytharcher](https://github.com/mytharcher): Compress HTML (\*.html) and JavaScript(\*.js) files when output.
|
378
|
+
- [smilify](https://github.com/SaswatPadhi/jekyll_smilify) by [SaswatPadhi](https://github.com/SaswatPadhi): Convert text emoticons in your content to themeable smiley pics. [Demo](http://saswatpadhi.github.com/)
|
379
|
+
- [excerpts](http://blog.darkrefraction.com/2012/jekyll-excerpt-plugin.html) by [drawoc](https://github.com/drawoc): provides a nice way to implement page excerpts.
|
380
|
+
|
381
|
+
<div class="note info">
|
382
|
+
<h5>Jekyll Plugins Wanted</h5>
|
383
|
+
<p>If you have a Jekyll plugin that you would like to see added to this list, you should <a href="../contributing">read the contributing page</a> to find out how to make that happen.</p>
|
384
|
+
</div>
|
@@ -0,0 +1,106 @@
|
|
1
|
+
---
|
2
|
+
layout: docs
|
3
|
+
title: Writing posts
|
4
|
+
prev_section: frontmatter
|
5
|
+
next_section: pages
|
6
|
+
---
|
7
|
+
|
8
|
+
One of Jekyll’s best aspects is that it is “blog aware”. What does that mean, exactly? Well, simply put it means that blogging is baked into Jekyll’s functionality by default. For people who write articles and publish them online, this means that you can publish and maintain a blog simply by managing a folder full of text-files on your computer. Compared to the hassle of configuring and maintaining databases and web-based CMS systems, this will be a welcome change for many.
|
9
|
+
|
10
|
+
## The Posts Folder
|
11
|
+
|
12
|
+
As detailed on the [directory structure](../structure) page, the `_posts` folder in any Jekyll site is where the files for all your articles will live. These files can be either [Markdown](http://daringfireball.net/projects/markdown/) or [Textile](http://textile.sitemonks.com/) formatted text files, and as long as they have [YAML front-matter](../frontmatter) defined, they will be converted from their source format into a HTML page that is part of your static site.
|
13
|
+
|
14
|
+
### Creating Post Files
|
15
|
+
|
16
|
+
To create a new post, all you need to do is create a new file in the `_posts` folder. The filename structure used for files in this folder is important—Jekyll requires the file to be named in the following format:
|
17
|
+
|
18
|
+
{% highlight bash %}
|
19
|
+
YEAR-MONTH-DAY-title.MARKUP
|
20
|
+
{% endhighlight %}
|
21
|
+
|
22
|
+
Where `YEAR` is a four-digit number, `MONTH` and `DAY` are both two-digit numbers, and `MARKUP` is an appropriate file extension for the format your post is written in. For example, the following are examples of excellent post filenames:
|
23
|
+
|
24
|
+
{% highlight bash %}
|
25
|
+
2011-12-31-new-years-eve-is-awesome.markdown
|
26
|
+
2012-09-12-how-to-write-a-blog.textile
|
27
|
+
{% endhighlight %}
|
28
|
+
|
29
|
+
### Content Formats
|
30
|
+
|
31
|
+
The first thing you need to put in any post is a section for [YAML front-matter](../frontmatter), but after that, it's simply a case of deciding which format you prefer to write in. Jekyll supports two popular content markup formats: [Markdown](http://daringfireball.net/projects/markdown/) or [Textile](http://textile.sitemonks.com/). These formats each have their own way of signifying different types of content within a post, so you should read up on how these formats work and decide which one suits your needs best.
|
32
|
+
|
33
|
+
## Including images and resources
|
34
|
+
|
35
|
+
For people who publish articles on a regular basis, it’s quite common to need to include things like images, links, downloads, and other resources along with their text-based content. While the ways to link to these resources differ between Markdown and Textile, the problem of working out where to store these files in your site is something everyone will face.
|
36
|
+
|
37
|
+
Because of Jekyll’s flexibility, there are many solutions to how to do this. One common solution is to create a folder in the root of the project directory called something like `assets` or `downloads`, into which any images, downloads or other resources are placed. Then, from within any post, they can be linked to using the site’s root as the path for the asset to include. Again, this will depend on the way your site’s (sub)domain and path are configured, but here some examples (in Markdown) of how you could do this using the `{{ "{{ site.url " }}}}` variable in a post.
|
38
|
+
|
39
|
+
Including an image asset in a post:
|
40
|
+
|
41
|
+
{% highlight bash %}
|
42
|
+
… which is shown in the screenshot below:
|
43
|
+
![My helpful screenshot]({{ "{{ site.url " }}}}/assets/screenshot.jpg)
|
44
|
+
{% endhighlight %}
|
45
|
+
|
46
|
+
Linking to a PDF for readers to download:
|
47
|
+
|
48
|
+
{% highlight bash %}
|
49
|
+
… you can [get the PDF]({{ "{{ site.url " }}}}/assets/mydoc.pdf) directly.
|
50
|
+
{% endhighlight %}
|
51
|
+
|
52
|
+
<div class="note">
|
53
|
+
<h5>ProTip™: Link using just the site root URL</h5>
|
54
|
+
<p>You can skip the <code>{{ "{{ site.url " }}}}</code> variable if you <strong>know</strong> your site will only ever be displayed at the root URL of your domain. In this case you can reference assets directly with just <code>/path/file.jpg</code>.</p>
|
55
|
+
</div>
|
56
|
+
|
57
|
+
## Displaying an index of posts
|
58
|
+
|
59
|
+
It’s all well and good to have posts in a folder, but a blog is no use unless you have a list of posts somewhere for people. Creating an index of posts on another page (or in a [template](../templates)) is easy, thanks to the [Liquid template language](http://liquidmarkup.org/) and it’s tags. Here’s a basic example of how to create an unordered list of links to posts for a Jekyll site:
|
60
|
+
|
61
|
+
{% highlight html %}
|
62
|
+
<ul>
|
63
|
+
{{ "{% for post in site.posts " }}%}
|
64
|
+
<li>
|
65
|
+
<a href="{{ "{{ post.url "}}}}">{{ "{{ post.title "}}}}</a>
|
66
|
+
</li>
|
67
|
+
{{ "{% endfor " }}%}
|
68
|
+
</ul>
|
69
|
+
{% endhighlight %}
|
70
|
+
|
71
|
+
Of course, you have full control over how (and where) you display your posts, and how you structure your site. You should read more about [how templates work](../templates) with Jekyll if you’re interested in these kinds of things.
|
72
|
+
|
73
|
+
## Highlighting code snippets
|
74
|
+
|
75
|
+
Jekyll also has built-in support for syntax highlighting of code snippets using [Pygments](../extras), and including a code snippet in any post is easy. Just use the dedicated Liquid tag as follows:
|
76
|
+
|
77
|
+
{% highlight ruby %}
|
78
|
+
{{ "{% highlight ruby"}} %}
|
79
|
+
def show
|
80
|
+
@widget = Widget(params[:id])
|
81
|
+
respond_to do |format|
|
82
|
+
format.html # show.html.erb
|
83
|
+
format.json { render json: @widget }
|
84
|
+
end
|
85
|
+
end
|
86
|
+
{{ "{% endhighlight"}} %}
|
87
|
+
{% endhighlight %}
|
88
|
+
|
89
|
+
And the output will look like this:
|
90
|
+
|
91
|
+
{% highlight ruby %}
|
92
|
+
def show
|
93
|
+
@widget = Widget(params[:id])
|
94
|
+
respond_to do |format|
|
95
|
+
format.html # show.html.erb
|
96
|
+
format.json { render json: @widget }
|
97
|
+
end
|
98
|
+
end
|
99
|
+
{% endhighlight %}
|
100
|
+
|
101
|
+
<div class="note">
|
102
|
+
<h5>ProTip™: Show line numbers</h5>
|
103
|
+
<p>You can make code snippets include line-numbers easily, simply add the word <code>linenos</code> to the end of the opening highlight tag like this: <code>{{ "{% highlight ruby linenos " }}%}</code>.</p>
|
104
|
+
</div>
|
105
|
+
|
106
|
+
Those basics should be more than enough to get you started writing your first posts. When you’re ready to dig into what else is possible, you might be interested in doing things like [customizing post permalinks](../permalinks) or using [custom variables](../variables) in your posts and elsewhere on your site.
|