jekyll-docs 3.5.2 → 3.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/site/404.html +3 -3
- data/site/community/index.html +5 -5
- data/site/docs/assets/index.html +14 -22
- data/site/docs/code_of_conduct/index.html +730 -0
- data/site/docs/collections/index.html +65 -80
- data/site/docs/conduct/index.html +4 -4
- data/site/docs/configuration/index.html +130 -156
- data/site/docs/continuous-integration/buddyworks/index.html +14 -16
- data/site/docs/continuous-integration/circleci/index.html +13 -21
- data/site/docs/continuous-integration/index.html +5 -5
- data/site/docs/continuous-integration/travis-ci/index.html +45 -73
- data/site/docs/contributing/index.html +10 -10
- data/site/docs/datafiles/index.html +37 -53
- data/site/docs/deployment-methods/index.html +54 -64
- data/site/docs/drafts/index.html +6 -8
- data/site/docs/extras/index.html +8 -12
- data/site/docs/frontmatter/index.html +10 -14
- data/site/docs/github-pages/index.html +10 -14
- data/site/docs/history/index.html +539 -440
- data/site/docs/home/index.html +4 -4
- data/site/docs/includes/index.html +42 -70
- data/site/docs/installation/index.html +23 -37
- data/site/docs/maintaining/affinity-team-captain/index.html +4 -4
- data/site/docs/maintaining/avoiding-burnout/index.html +4 -4
- data/site/docs/maintaining/becoming-a-maintainer/index.html +4 -4
- data/site/docs/maintaining/index.html +4 -4
- data/site/docs/maintaining/merging-a-pull-request/index.html +6 -8
- data/site/docs/maintaining/reviewing-a-pull-request/index.html +4 -4
- data/site/docs/maintaining/special-labels/index.html +4 -4
- data/site/docs/maintaining/triaging-an-issue/index.html +4 -4
- data/site/docs/migrations/index.html +4 -4
- data/site/docs/pages/index.html +8 -12
- data/site/docs/pagination/index.html +13 -21
- data/site/docs/permalinks/index.html +43 -34
- data/site/docs/plugins/index.html +51 -79
- data/site/docs/posts/index.html +26 -48
- data/site/docs/quickstart/index.html +6 -8
- data/site/docs/resources/index.html +45 -21
- data/site/docs/sites/index.html +4 -4
- data/site/docs/static-files/index.html +12 -16
- data/site/docs/structure/index.html +6 -8
- data/site/docs/templates/index.html +36 -68
- data/site/docs/themes/index.html +32 -49
- data/site/docs/troubleshooting/index.html +44 -82
- data/site/docs/upgrading/0-to-2/index.html +7 -9
- data/site/docs/upgrading/2-to-3/index.html +19 -31
- data/site/docs/upgrading/index.html +4 -4
- data/site/docs/usage/index.html +20 -30
- data/site/docs/variables/index.html +26 -10
- data/site/docs/windows/index.html +36 -58
- data/site/feed.xml +47 -53
- data/site/help/index.html +3 -3
- data/site/index.html +3 -3
- data/site/latest_version.txt +1 -1
- data/site/news/2013/05/05/jekyll-1-0-0-released/index.html +16 -8
- data/site/news/2013/05/08/jekyll-1-0-1-released/index.html +16 -8
- data/site/news/2013/05/12/jekyll-1-0-2-released/index.html +16 -8
- data/site/news/2013/06/07/jekyll-1-0-3-released/index.html +16 -8
- data/site/news/2013/07/14/jekyll-1-1-0-released/index.html +16 -8
- data/site/news/2013/07/24/jekyll-1-1-1-released/index.html +16 -8
- data/site/news/2013/07/25/jekyll-1-0-4-released/index.html +16 -8
- data/site/news/2013/07/25/jekyll-1-1-2-released/index.html +16 -8
- data/site/news/2013/09/06/jekyll-1-2-0-released/index.html +16 -8
- data/site/news/2013/09/14/jekyll-1-2-1-released/index.html +16 -8
- data/site/news/2013/10/28/jekyll-1-3-0-rc1-released/index.html +16 -8
- data/site/news/2013/11/04/jekyll-1-3-0-released/index.html +16 -8
- data/site/news/2013/11/26/jekyll-1-3-1-released/index.html +16 -8
- data/site/news/2013/12/07/jekyll-1-4-0-released/index.html +16 -8
- data/site/news/2013/12/09/jekyll-1-4-1-released/index.html +16 -8
- data/site/news/2013/12/16/jekyll-1-4-2-released/index.html +16 -8
- data/site/news/2014/01/13/jekyll-1-4-3-released/index.html +16 -8
- data/site/news/2014/03/24/jekyll-1-5-0-released/index.html +16 -8
- data/site/news/2014/03/27/jekyll-1-5-1-released/index.html +16 -8
- data/site/news/2014/05/06/jekyll-turns-2-0-0/index.html +16 -8
- data/site/news/2014/05/08/jekyll-2-0-3-released/index.html +16 -8
- data/site/news/2014/06/04/jekyll-stickers-1-dollar-stickermule/index.html +16 -8
- data/site/news/2014/06/28/jekyll-turns-21-i-mean-2-1-0/index.html +16 -8
- data/site/news/2014/07/01/jekyll-2-1-1-released/index.html +16 -8
- data/site/news/2014/07/29/jekyll-2-2-0-released/index.html +16 -8
- data/site/news/2014/08/10/jekyll-2-3-0-released/index.html +16 -8
- data/site/news/2014/09/09/jekyll-2-4-0-released/index.html +16 -8
- data/site/news/2014/11/05/jekylls-midlife-crisis-jekyll-turns-2-5-0/index.html +16 -8
- data/site/news/2014/11/09/jekyll-2-5-1-released/index.html +16 -8
- data/site/news/2014/11/12/jekyll-2-5-2-released/index.html +16 -8
- data/site/news/2014/12/17/alfredxing-welcome-to-jekyll-core/index.html +16 -8
- data/site/news/2014/12/22/jekyll-2-5-3-released/index.html +16 -8
- data/site/news/2015/01/20/jekyll-meet-and-greet/index.html +16 -8
- data/site/news/2015/01/24/jekyll-3-0-0-beta1-released/index.html +17 -9
- data/site/news/2015/02/26/introducing-jekyll-talk/index.html +16 -8
- data/site/news/2015/10/26/jekyll-3-0-released/index.html +16 -8
- data/site/news/2015/11/17/jekyll-3-0-1-released/index.html +16 -8
- data/site/news/2016/01/20/jekyll-3-0-2-released/index.html +16 -8
- data/site/news/2016/01/24/jekyll-3-1-0-released/index.html +16 -8
- data/site/news/2016/01/28/jekyll-3-1-1-released/index.html +16 -8
- data/site/news/2016/02/08/jekyll-3-0-3-released/index.html +16 -8
- data/site/news/2016/02/19/jekyll-3-1-2-released/index.html +16 -8
- data/site/news/2016/03/10/making-it-easier-to-contribute-to-jekyll/index.html +16 -8
- data/site/news/2016/04/19/jekyll-3-0-4-released/index.html +20 -12
- data/site/news/2016/04/19/jekyll-3-1-3-released/index.html +16 -8
- data/site/news/2016/04/26/jekyll-3-0-5-released/index.html +16 -8
- data/site/news/2016/05/18/jekyll-3-1-4-released/index.html +16 -8
- data/site/news/2016/05/18/jekyll-3-1-5-released/index.html +16 -8
- data/site/news/2016/05/19/jekyll-3-1-6-released/index.html +16 -8
- data/site/news/2016/06/03/update-on-jekyll-s-google-summer-of-code-projects/index.html +16 -8
- data/site/news/2016/07/26/jekyll-3-2-0-released/index.html +16 -8
- data/site/news/2016/08/02/jekyll-3-2-1-released/index.html +16 -8
- data/site/news/2016/08/24/jekyll-admin-initial-release/index.html +16 -8
- data/site/news/2016/10/06/jekyll-3-3-is-here/index.html +16 -8
- data/site/news/2016/11/14/jekyll-3-3-1-released/index.html +16 -8
- data/site/news/2017/01/18/jekyll-3-4-0-released/index.html +16 -8
- data/site/news/2017/03/02/jekyll-3-4-1-released/index.html +27 -29
- data/site/news/2017/03/09/jekyll-3-4-2-released/index.html +23 -17
- data/site/news/2017/03/21/jekyll-3-4-3-released/index.html +20 -14
- data/site/news/2017/06/15/jekyll-3-5-0-released/index.html +21 -13
- data/site/news/2017/07/17/jekyll-3-5-1-released/index.html +18 -10
- data/site/news/2017/08/12/jekyll-3-5-2-released/index.html +573 -0
- data/site/news/2017/09/21/jekyll-3-6-0-released/index.html +565 -0
- data/site/news/index.html +122 -48
- data/site/news/releases/index.html +122 -48
- data/site/sitemap.xml +64 -52
- data/site/tutorials/convert-site-to-jekyll/index.html +80 -138
- data/site/tutorials/custom-404-page/index.html +13 -21
- data/site/tutorials/home/index.html +4 -4
- data/site/tutorials/navigation/index.html +144 -180
- data/site/tutorials/orderofinterpretation/index.html +27 -45
- metadata +8 -5
@@ -4,13 +4,13 @@
|
|
4
4
|
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
5
5
|
<meta charset="UTF-8">
|
6
6
|
<meta name="viewport" content="width=device-width,initial-scale=1">
|
7
|
-
<meta name="generator" content="Jekyll v3.
|
7
|
+
<meta name="generator" content="Jekyll v3.6.0">
|
8
8
|
<link type="application/atom+xml" rel="alternate" href="https://jekyllrb.com/feed.xml" title="Jekyll • Simple, blog-aware, static sites">
|
9
9
|
<link rel="alternate" type="application/atom+xml" title="Recent commits to Jekyll’s master branch" href="https://github.com/jekyll/jekyll/commits/master.atom">
|
10
10
|
<link rel="stylesheet" href="//fonts.googleapis.com/css?family=Lato:300,300italic,400,400italic,700,700italic,900">
|
11
11
|
<link rel="stylesheet" href="/css/screen.css">
|
12
12
|
<link rel="icon" type="image/x-icon" href="/favicon.ico">
|
13
|
-
<!-- Begin Jekyll SEO tag v2.
|
13
|
+
<!-- Begin Jekyll SEO tag v2.3.0 -->
|
14
14
|
<title>Plugins | Jekyll • Simple, blog-aware, static sites</title>
|
15
15
|
<meta property="og:title" content="Plugins">
|
16
16
|
<meta property="og:locale" content="en_US">
|
@@ -20,12 +20,12 @@
|
|
20
20
|
<meta property="og:url" content="https://jekyllrb.com/docs/plugins/">
|
21
21
|
<meta property="og:site_name" content="Jekyll • Simple, blog-aware, static sites">
|
22
22
|
<meta property="og:type" content="article">
|
23
|
-
<meta property="article:published_time" content="2017-
|
23
|
+
<meta property="article:published_time" content="2017-10-24T08:07:43-07:00">
|
24
24
|
<meta name="twitter:card" content="summary">
|
25
25
|
<meta name="twitter:site" content="@jekyllrb">
|
26
26
|
<meta name="google-site-verification" content="onQcXpAvtHBrUI5LlroHNE_FP0b2qvFyPq7VZw36iEY">
|
27
27
|
<script type="application/ld+json">
|
28
|
-
{"
|
28
|
+
{"name":null,"description":"Jekyll has a plugin system with hooks that allow you to create custom generated content specific to your site. You can run custom code for your site without having to modify the Jekyll source itself.","url":"https://jekyllrb.com/docs/plugins/","headline":"Plugins","dateModified":"2017-10-24T08:07:43-07:00","datePublished":"2017-10-24T08:07:43-07:00","sameAs":null,"@type":"BlogPosting","author":null,"image":null,"publisher":{"@type":"Organization","logo":{"@type":"ImageObject","url":"https://jekyllrb.com/img/logo-2x.png"}},"mainEntityOfPage":{"@type":"WebPage","@id":"https://jekyllrb.com/docs/plugins/"},"@context":"http://schema.org"}</script>
|
29
29
|
<!-- End Jekyll SEO tag -->
|
30
30
|
|
31
31
|
<!--[if lt IE 9]>
|
@@ -317,26 +317,30 @@ Jekyll generates your site.</li>
|
|
317
317
|
values of the gem names of the plugins you’d like to use. An example:</p>
|
318
318
|
|
319
319
|
<div class="highlighter-rouge">
|
320
|
-
<pre class="highlight"><code> plugins:
|
320
|
+
<div class="highlight"><pre class="highlight"><code> plugins:
|
321
|
+
- jekyll-gist
|
322
|
+
- jekyll-coffeescript
|
323
|
+
- jekyll-assets
|
324
|
+
- another-jekyll-plugin
|
321
325
|
# This will require each of these plugins automatically.
|
322
|
-
</code></pre>
|
323
|
-
</div>
|
326
|
+
</code></pre></div> </div>
|
324
327
|
|
325
|
-
<p>Then install your plugins using <code class="highlighter-rouge">gem install jekyll-coffeescript jekyll-
|
328
|
+
<p>Then install your plugins using <code class="highlighter-rouge">gem install jekyll-gist jekyll-coffeescript jekyll-assets another-jekyll-plugin</code></p>
|
326
329
|
</li>
|
327
330
|
<li>
|
328
331
|
<p>Add the relevant plugins to a Bundler group in your <code class="highlighter-rouge">Gemfile</code>. An
|
329
332
|
example:</p>
|
330
333
|
|
331
334
|
<div class="highlighter-rouge">
|
332
|
-
<pre class="highlight"><code> group :jekyll_plugins do
|
333
|
-
gem "
|
335
|
+
<div class="highlight"><pre class="highlight"><code> group :jekyll_plugins do
|
336
|
+
gem "jekyll-gist"
|
337
|
+
gem "jekyll-coffeescript"
|
338
|
+
gem "jekyll-assets"
|
334
339
|
gem "another-jekyll-plugin"
|
335
340
|
end
|
336
|
-
</code></pre>
|
337
|
-
</div>
|
341
|
+
</code></pre></div> </div>
|
338
342
|
|
339
|
-
<p>Now you need to install all plugins from your Bundler group by running single command <code class="highlighter-rouge">bundle install</code
|
343
|
+
<p>Now you need to install all plugins from your Bundler group by running single command <code class="highlighter-rouge">bundle install</code>.</p>
|
340
344
|
</li>
|
341
345
|
</ol>
|
342
346
|
|
@@ -352,7 +356,7 @@ values of the gem names of the plugins you’d like to use. An example:</p>
|
|
352
356
|
</p>
|
353
357
|
</div>
|
354
358
|
|
355
|
-
<p>In general, plugins you make will fall into one of five categories:</p>
|
359
|
+
<p>In general, plugins you make will fall broadly into one of five categories:</p>
|
356
360
|
|
357
361
|
<ol>
|
358
362
|
<li><a href="#generators">Generators</a></li>
|
@@ -362,6 +366,8 @@ values of the gem names of the plugins you’d like to use. An example:</p>
|
|
362
366
|
<li><a href="#hooks">Hooks</a></li>
|
363
367
|
</ol>
|
364
368
|
|
369
|
+
<p>See the bottom of the page for a <a href="#available-plugins">list of available plugins</a></p>
|
370
|
+
|
365
371
|
<h2 id="generators">Generators</h2>
|
366
372
|
|
367
373
|
<p>You can create a generator when you need Jekyll to create additional content
|
@@ -387,8 +393,7 @@ for more details.</p>
|
|
387
393
|
variables. In the following example the template <code class="highlighter-rouge">reading.html</code> has two
|
388
394
|
variables <code class="highlighter-rouge">ongoing</code> and <code class="highlighter-rouge">done</code> that we fill in the generator:</p>
|
389
395
|
|
390
|
-
<div class="language-ruby highlighter-rouge">
|
391
|
-
<pre class="highlight"><code><span class="k">module</span> <span class="nn">Reading</span>
|
396
|
+
<div class="language-ruby highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="k">module</span> <span class="nn">Reading</span>
|
392
397
|
<span class="k">class</span> <span class="nc">Generator</span> <span class="o"><</span> <span class="no">Jekyll</span><span class="o">::</span><span class="no">Generator</span>
|
393
398
|
<span class="k">def</span> <span class="nf">generate</span><span class="p">(</span><span class="n">site</span><span class="p">)</span>
|
394
399
|
<span class="n">ongoing</span><span class="p">,</span> <span class="n">done</span> <span class="o">=</span> <span class="no">Book</span><span class="p">.</span><span class="nf">all</span><span class="p">.</span><span class="nf">partition</span><span class="p">(</span><span class="o">&</span><span class="ss">:ongoing?</span><span class="p">)</span>
|
@@ -399,13 +404,11 @@ variables <code class="highlighter-rouge">ongoing</code> and <code class="highli
|
|
399
404
|
<span class="k">end</span>
|
400
405
|
<span class="k">end</span>
|
401
406
|
<span class="k">end</span>
|
402
|
-
</code></pre>
|
403
|
-
</div>
|
407
|
+
</code></pre></div></div>
|
404
408
|
|
405
409
|
<p>This is a more complex generator that generates new pages:</p>
|
406
410
|
|
407
|
-
<div class="language-ruby highlighter-rouge">
|
408
|
-
<pre class="highlight"><code><span class="k">module</span> <span class="nn">Jekyll</span>
|
411
|
+
<div class="language-ruby highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="k">module</span> <span class="nn">Jekyll</span>
|
409
412
|
|
410
413
|
<span class="k">class</span> <span class="nc">CategoryPage</span> <span class="o"><</span> <span class="no">Page</span>
|
411
414
|
<span class="k">def</span> <span class="nf">initialize</span><span class="p">(</span><span class="n">site</span><span class="p">,</span> <span class="n">base</span><span class="p">,</span> <span class="n">dir</span><span class="p">,</span> <span class="n">category</span><span class="p">)</span>
|
@@ -437,8 +440,7 @@ variables <code class="highlighter-rouge">ongoing</code> and <code class="highli
|
|
437
440
|
<span class="k">end</span>
|
438
441
|
|
439
442
|
<span class="k">end</span>
|
440
|
-
</code></pre>
|
441
|
-
</div>
|
443
|
+
</code></pre></div></div>
|
442
444
|
|
443
445
|
<p>In this example, our generator will create a series of files under the
|
444
446
|
<code class="highlighter-rouge">categories</code> directory for each category, listing the posts in each category
|
@@ -485,8 +487,7 @@ languages are implemented using this method.</p>
|
|
485
487
|
<p>Below is a converter that will take all posts ending in <code class="highlighter-rouge">.upcase</code> and process
|
486
488
|
them using the <code class="highlighter-rouge">UpcaseConverter</code>:</p>
|
487
489
|
|
488
|
-
<div class="language-ruby highlighter-rouge">
|
489
|
-
<pre class="highlight"><code><span class="k">module</span> <span class="nn">Jekyll</span>
|
490
|
+
<div class="language-ruby highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="k">module</span> <span class="nn">Jekyll</span>
|
490
491
|
<span class="k">class</span> <span class="nc">UpcaseConverter</span> <span class="o"><</span> <span class="no">Converter</span>
|
491
492
|
<span class="n">safe</span> <span class="kp">true</span>
|
492
493
|
<span class="n">priority</span> <span class="ss">:low</span>
|
@@ -504,8 +505,7 @@ them using the <code class="highlighter-rouge">UpcaseConverter</code>:</p>
|
|
504
505
|
<span class="k">end</span>
|
505
506
|
<span class="k">end</span>
|
506
507
|
<span class="k">end</span>
|
507
|
-
</code></pre>
|
508
|
-
</div>
|
508
|
+
</code></pre></div></div>
|
509
509
|
|
510
510
|
<p>Converters should implement at a minimum 3 methods:</p>
|
511
511
|
|
@@ -563,18 +563,15 @@ it will do so with a <code class="highlighter-rouge">.html</code> extension.</p>
|
|
563
563
|
subcommands for the <code class="highlighter-rouge">jekyll</code> executable. This is possible by including the
|
564
564
|
relevant plugins in a <code class="highlighter-rouge">Gemfile</code> group called <code class="highlighter-rouge">:jekyll_plugins</code>:</p>
|
565
565
|
|
566
|
-
<div class="language-ruby highlighter-rouge">
|
567
|
-
<pre class="highlight"><code><span class="n">group</span> <span class="ss">:jekyll_plugins</span> <span class="k">do</span>
|
566
|
+
<div class="language-ruby highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">group</span> <span class="ss">:jekyll_plugins</span> <span class="k">do</span>
|
568
567
|
<span class="n">gem</span> <span class="s2">"my_fancy_jekyll_plugin"</span>
|
569
568
|
<span class="k">end</span>
|
570
|
-
</code></pre>
|
571
|
-
</div>
|
569
|
+
</code></pre></div></div>
|
572
570
|
|
573
571
|
<p>Each <code class="highlighter-rouge">Command</code> must be a subclass of the <code class="highlighter-rouge">Jekyll::Command</code> class and must
|
574
572
|
contain one class method: <code class="highlighter-rouge">init_with_program</code>. An example:</p>
|
575
573
|
|
576
|
-
<div class="language-ruby highlighter-rouge">
|
577
|
-
<pre class="highlight"><code><span class="k">class</span> <span class="nc">MyNewCommand</span> <span class="o"><</span> <span class="no">Jekyll</span><span class="o">::</span><span class="no">Command</span>
|
574
|
+
<div class="language-ruby highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="k">class</span> <span class="nc">MyNewCommand</span> <span class="o"><</span> <span class="no">Jekyll</span><span class="o">::</span><span class="no">Command</span>
|
578
575
|
<span class="k">class</span> <span class="o"><<</span> <span class="nb">self</span>
|
579
576
|
<span class="k">def</span> <span class="nf">init_with_program</span><span class="p">(</span><span class="n">prog</span><span class="p">)</span>
|
580
577
|
<span class="n">prog</span><span class="p">.</span><span class="nf">command</span><span class="p">(</span><span class="ss">:new</span><span class="p">)</span> <span class="k">do</span> <span class="o">|</span><span class="n">c</span><span class="o">|</span>
|
@@ -590,8 +587,7 @@ contain one class method: <code class="highlighter-rouge">init_with_program</cod
|
|
590
587
|
<span class="k">end</span>
|
591
588
|
<span class="k">end</span>
|
592
589
|
<span class="k">end</span>
|
593
|
-
</code></pre>
|
594
|
-
</div>
|
590
|
+
</code></pre></div></div>
|
595
591
|
|
596
592
|
<p>Commands should implement this single class method:</p>
|
597
593
|
|
@@ -627,8 +623,7 @@ hooking into the tagging system. Built-in examples added by Jekyll include the
|
|
627
623
|
<code class="highlighter-rouge">highlight</code> and <code class="highlighter-rouge">include</code> tags. Below is an example of a custom liquid tag that
|
628
624
|
will output the time the page was rendered:</p>
|
629
625
|
|
630
|
-
<div class="language-ruby highlighter-rouge">
|
631
|
-
<pre class="highlight"><code><span class="k">module</span> <span class="nn">Jekyll</span>
|
626
|
+
<div class="language-ruby highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="k">module</span> <span class="nn">Jekyll</span>
|
632
627
|
<span class="k">class</span> <span class="nc">RenderTimeTag</span> <span class="o"><</span> <span class="no">Liquid</span><span class="o">::</span><span class="no">Tag</span>
|
633
628
|
|
634
629
|
<span class="k">def</span> <span class="nf">initialize</span><span class="p">(</span><span class="n">tag_name</span><span class="p">,</span> <span class="n">text</span><span class="p">,</span> <span class="n">tokens</span><span class="p">)</span>
|
@@ -643,8 +638,7 @@ will output the time the page was rendered:</p>
|
|
643
638
|
<span class="k">end</span>
|
644
639
|
|
645
640
|
<span class="no">Liquid</span><span class="o">::</span><span class="no">Template</span><span class="p">.</span><span class="nf">register_tag</span><span class="p">(</span><span class="s1">'render_time'</span><span class="p">,</span> <span class="no">Jekyll</span><span class="o">::</span><span class="no">RenderTimeTag</span><span class="p">)</span>
|
646
|
-
</code></pre>
|
647
|
-
</div>
|
641
|
+
</code></pre></div></div>
|
648
642
|
|
649
643
|
<p>At a minimum, liquid tags must implement:</p>
|
650
644
|
|
@@ -672,27 +666,21 @@ will output the time the page was rendered:</p>
|
|
672
666
|
<p>You must also register the custom tag with the Liquid template engine as
|
673
667
|
follows:</p>
|
674
668
|
|
675
|
-
<div class="language-ruby highlighter-rouge">
|
676
|
-
|
677
|
-
</code></pre>
|
678
|
-
</div>
|
669
|
+
<div class="language-ruby highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="no">Liquid</span><span class="o">::</span><span class="no">Template</span><span class="p">.</span><span class="nf">register_tag</span><span class="p">(</span><span class="s1">'render_time'</span><span class="p">,</span> <span class="no">Jekyll</span><span class="o">::</span><span class="no">RenderTimeTag</span><span class="p">)</span>
|
670
|
+
</code></pre></div></div>
|
679
671
|
|
680
672
|
<p>In the example above, we can place the following tag anywhere in one of our
|
681
673
|
pages:</p>
|
682
674
|
|
683
|
-
<div class="language-ruby highlighter-rouge">
|
684
|
-
<pre class="highlight"><code>
|
675
|
+
<div class="language-ruby highlighter-rouge"><div class="highlight"><pre class="highlight"><code>
|
685
676
|
<span class="o"><</span><span class="nb">p</span><span class="o">></span><span class="p">{</span><span class="sx">% render_time </span><span class="n">page</span> <span class="n">rendered</span> <span class="ss">at: </span><span class="sx">%}</p>
|
686
677
|
|
687
|
-
</span></code></pre>
|
688
|
-
</div>
|
678
|
+
</span></code></pre></div></div>
|
689
679
|
|
690
680
|
<p>And we would get something like this on the page:</p>
|
691
681
|
|
692
|
-
<div class="language-html highlighter-rouge">
|
693
|
-
|
694
|
-
</code></pre>
|
695
|
-
</div>
|
682
|
+
<div class="language-html highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nt"><p></span>page rendered at: Tue June 22 23:38:47 –0500 2010<span class="nt"></p></span>
|
683
|
+
</code></pre></div></div>
|
696
684
|
|
697
685
|
<h3 id="liquid-filters">Liquid filters</h3>
|
698
686
|
|
@@ -701,8 +689,7 @@ add tags above. Filters are simply modules that export their methods to liquid.
|
|
701
689
|
All methods will have to take at least one parameter which represents the input
|
702
690
|
of the filter. The return value will be the output of the filter.</p>
|
703
691
|
|
704
|
-
<div class="language-ruby highlighter-rouge">
|
705
|
-
<pre class="highlight"><code><span class="k">module</span> <span class="nn">Jekyll</span>
|
692
|
+
<div class="language-ruby highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="k">module</span> <span class="nn">Jekyll</span>
|
706
693
|
<span class="k">module</span> <span class="nn">AssetFilter</span>
|
707
694
|
<span class="k">def</span> <span class="nf">asset_url</span><span class="p">(</span><span class="n">input</span><span class="p">)</span>
|
708
695
|
<span class="s2">"http://www.example.com/</span><span class="si">#{</span><span class="n">input</span><span class="si">}</span><span class="s2">?</span><span class="si">#{</span><span class="no">Time</span><span class="p">.</span><span class="nf">now</span><span class="p">.</span><span class="nf">to_i</span><span class="si">}</span><span class="s2">"</span>
|
@@ -711,8 +698,7 @@ of the filter. The return value will be the output of the filter.</p>
|
|
711
698
|
<span class="k">end</span>
|
712
699
|
|
713
700
|
<span class="no">Liquid</span><span class="o">::</span><span class="no">Template</span><span class="p">.</span><span class="nf">register_filter</span><span class="p">(</span><span class="no">Jekyll</span><span class="o">::</span><span class="no">AssetFilter</span><span class="p">)</span>
|
714
|
-
</code></pre>
|
715
|
-
</div>
|
701
|
+
</code></pre></div></div>
|
716
702
|
|
717
703
|
<div class="note">
|
718
704
|
<h5>ProTip™: Access the site object using Liquid</h5>
|
@@ -773,16 +759,14 @@ of the filter. The return value will be the output of the filter.</p>
|
|
773
759
|
<p>To use one of the example plugins above as an illustration, here is how you’d
|
774
760
|
specify these two flags:</p>
|
775
761
|
|
776
|
-
<div class="language-ruby highlighter-rouge">
|
777
|
-
<pre class="highlight"><code><span class="k">module</span> <span class="nn">Jekyll</span>
|
762
|
+
<div class="language-ruby highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="k">module</span> <span class="nn">Jekyll</span>
|
778
763
|
<span class="k">class</span> <span class="nc">UpcaseConverter</span> <span class="o"><</span> <span class="no">Converter</span>
|
779
764
|
<span class="n">safe</span> <span class="kp">true</span>
|
780
765
|
<span class="n">priority</span> <span class="ss">:low</span>
|
781
|
-
<span class="
|
782
|
-
<span class="
|
766
|
+
<span class="o">...</span>
|
767
|
+
<span class="k">end</span>
|
783
768
|
<span class="k">end</span>
|
784
|
-
</code></pre>
|
785
|
-
</div>
|
769
|
+
</code></pre></div></div>
|
786
770
|
|
787
771
|
<h2 id="hooks">Hooks</h2>
|
788
772
|
|
@@ -796,12 +780,10 @@ call whenever the hook is triggered. For example, if you want to execute some
|
|
796
780
|
custom functionality every time Jekyll renders a post, you could register a
|
797
781
|
hook like this:</p>
|
798
782
|
|
799
|
-
<div class="language-ruby highlighter-rouge">
|
800
|
-
<pre class="highlight"><code><span class="no">Jekyll</span><span class="o">::</span><span class="no">Hooks</span><span class="p">.</span><span class="nf">register</span> <span class="ss">:posts</span><span class="p">,</span> <span class="ss">:post_render</span> <span class="k">do</span> <span class="o">|</span><span class="n">post</span><span class="o">|</span>
|
783
|
+
<div class="language-ruby highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="no">Jekyll</span><span class="o">::</span><span class="no">Hooks</span><span class="p">.</span><span class="nf">register</span> <span class="ss">:posts</span><span class="p">,</span> <span class="ss">:post_render</span> <span class="k">do</span> <span class="o">|</span><span class="n">post</span><span class="o">|</span>
|
801
784
|
<span class="c1"># code to call after Jekyll renders a post</span>
|
802
785
|
<span class="k">end</span>
|
803
|
-
</code></pre>
|
804
|
-
</div>
|
786
|
+
</code></pre></div></div>
|
805
787
|
|
806
788
|
<p>Jekyll provides hooks for <code>:site</code>, <code>:pages</code>,
|
807
789
|
<code>:posts</code>, and <code>:documents</code>. In all cases, Jekyll calls
|
@@ -1197,8 +1179,12 @@ LESS.js files during generation.</li>
|
|
1197
1179
|
|
1198
1180
|
<h4 id="tags-1">Tags</h4>
|
1199
1181
|
|
1182
|
+
<p>You can find a few useful plugins at the following locations:</p>
|
1183
|
+
|
1200
1184
|
<ul>
|
1201
1185
|
<li>
|
1186
|
+
<a href="https://github.com/jekyll/jekyll-gist">Jekyll-gist</a>: Use the <code class="highlighter-rouge">gist</code> tag to easily embed a GitHub Gist onto your site. This works with public or secret gists.</li>
|
1187
|
+
<li>
|
1202
1188
|
<a href="https://github.com/samrayner/jekyll-asset-path-plugin">Asset Path Tag</a> by <a href="http://www.samrayner.com/">Sam Rayner</a>: Allows organisation of assets into subdirectories by outputting a path for a given file relative to the current post or page.</li>
|
1203
1189
|
<li>
|
1204
1190
|
<a href="https://github.com/christianhellsten/jekyll-plugins">Delicious Plugin by Christian Hellsten</a>: Fetches and renders bookmarks from delicious.com.</li>
|
@@ -1389,7 +1375,7 @@ plugin to generate publication lists from <a href="https://www.bibsonomy.org/">B
|
|
1389
1375
|
<li>
|
1390
1376
|
<a href="https://github.com/dannygarcia/grunt-jekyll">grunt-jekyll</a>: A straightforward <a href="http://gruntjs.com/">Grunt</a> plugin for Jekyll.</li>
|
1391
1377
|
<li>
|
1392
|
-
<a href="https://github.com/indirect/jekyll-postfiles">jekyll-postfiles</a>: Add <code class="highlighter-rouge">_postfiles</code> directory and <code class="highlighter-rouge"
|
1378
|
+
<a href="https://github.com/indirect/jekyll-postfiles">jekyll-postfiles</a>: Add <code class="highlighter-rouge">_postfiles</code> directory and <code class="highlighter-rouge">{{ postfile }}</code> tag so the files a post refers to will always be right there inside your repo.</li>
|
1393
1379
|
<li>
|
1394
1380
|
<a href="http://jch.penibelst.de/">A layout that compresses HTML</a>: GitHub Pages compatible, configurable way to compress HTML files on site build.</li>
|
1395
1381
|
<li>
|
@@ -1434,20 +1420,6 @@ plugin to generate publication lists from <a href="https://www.bibsonomy.org/">B
|
|
1434
1420
|
<a href="https://github.com/mpchadwick/jekyll-pre-commit">jekyll-pre-commit</a>: A framework for running checks against your posts using a git pre-commit hook before you publish them.</li>
|
1435
1421
|
</ul>
|
1436
1422
|
|
1437
|
-
<h4 id="editors">Editors</h4>
|
1438
|
-
|
1439
|
-
<ul>
|
1440
|
-
<li>
|
1441
|
-
<a href="https://github.com/23maverick23/sublime-jekyll">sublime-jekyll</a>: A Sublime Text package for Jekyll static sites. This package should help creating Jekyll sites and posts easier by providing access to key template tags and filters, as well as common completions and a current date/datetime command (for dating posts). You can install this package manually via GitHub, or via <a href="https://packagecontrol.io/packages/Jekyll">Package Control</a>.</li>
|
1442
|
-
<li>
|
1443
|
-
<a href="https://github.com/parkr/vim-jekyll">vim-jekyll</a>: A vim plugin to generate
|
1444
|
-
new posts and run <code class="highlighter-rouge">jekyll build</code> all without leaving vim.</li>
|
1445
|
-
<li>
|
1446
|
-
<a href="https://atom.io/packages/markdown-writer">markdown-writer</a>: An Atom package for Jekyll. It can create new posts/drafts, manage tags/categories, insert link/images and add many useful key mappings.</li>
|
1447
|
-
<li>
|
1448
|
-
<a href="https://wordpress.org/plugins/wp2jekyll/">Wordpress2Jekyll</a>: A Wordpress plugin that allows you to use Wordpress as your editor and (automatically) export content in to Jekyll. WordPress2Jekyll attempts to marry these two systems together in order to make a site that can be easily managed from all devices.</li>
|
1449
|
-
</ul>
|
1450
|
-
|
1451
1423
|
<div class="note info">
|
1452
1424
|
<h5>Jekyll Plugins Wanted</h5>
|
1453
1425
|
<p>
|
data/site/docs/posts/index.html
CHANGED
@@ -4,13 +4,13 @@
|
|
4
4
|
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
5
5
|
<meta charset="UTF-8">
|
6
6
|
<meta name="viewport" content="width=device-width,initial-scale=1">
|
7
|
-
<meta name="generator" content="Jekyll v3.
|
7
|
+
<meta name="generator" content="Jekyll v3.6.0">
|
8
8
|
<link type="application/atom+xml" rel="alternate" href="https://jekyllrb.com/feed.xml" title="Jekyll • Simple, blog-aware, static sites">
|
9
9
|
<link rel="alternate" type="application/atom+xml" title="Recent commits to Jekyll’s master branch" href="https://github.com/jekyll/jekyll/commits/master.atom">
|
10
10
|
<link rel="stylesheet" href="//fonts.googleapis.com/css?family=Lato:300,300italic,400,400italic,700,700italic,900">
|
11
11
|
<link rel="stylesheet" href="/css/screen.css">
|
12
12
|
<link rel="icon" type="image/x-icon" href="/favicon.ico">
|
13
|
-
<!-- Begin Jekyll SEO tag v2.
|
13
|
+
<!-- Begin Jekyll SEO tag v2.3.0 -->
|
14
14
|
<title>Writing posts | Jekyll • Simple, blog-aware, static sites</title>
|
15
15
|
<meta property="og:title" content="Writing posts">
|
16
16
|
<meta property="og:locale" content="en_US">
|
@@ -20,12 +20,12 @@
|
|
20
20
|
<meta property="og:url" content="https://jekyllrb.com/docs/posts/">
|
21
21
|
<meta property="og:site_name" content="Jekyll • Simple, blog-aware, static sites">
|
22
22
|
<meta property="og:type" content="article">
|
23
|
-
<meta property="article:published_time" content="2017-
|
23
|
+
<meta property="article:published_time" content="2017-10-24T08:07:43-07:00">
|
24
24
|
<meta name="twitter:card" content="summary">
|
25
25
|
<meta name="twitter:site" content="@jekyllrb">
|
26
26
|
<meta name="google-site-verification" content="onQcXpAvtHBrUI5LlroHNE_FP0b2qvFyPq7VZw36iEY">
|
27
27
|
<script type="application/ld+json">
|
28
|
-
{"
|
28
|
+
{"name":null,"description":"One of Jekyll’s best aspects is that it is “blog aware”. What does this mean, exactly? Well, simply put, it means that blogging is baked into Jekyll’s functionality. If you write articles and publish them online, you can publish and maintain a blog simply by managing a folder 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!","url":"https://jekyllrb.com/docs/posts/","headline":"Writing posts","dateModified":"2017-10-24T08:07:43-07:00","datePublished":"2017-10-24T08:07:43-07:00","sameAs":null,"@type":"BlogPosting","author":null,"image":null,"publisher":{"@type":"Organization","logo":{"@type":"ImageObject","url":"https://jekyllrb.com/img/logo-2x.png"}},"mainEntityOfPage":{"@type":"WebPage","@id":"https://jekyllrb.com/docs/posts/"},"@context":"http://schema.org"}</script>
|
29
29
|
<!-- End Jekyll SEO tag -->
|
30
30
|
|
31
31
|
<!--[if lt IE 9]>
|
@@ -310,20 +310,16 @@ static site.</p>
|
|
310
310
|
directory. How you name files in this folder is important. Jekyll requires blog
|
311
311
|
post files to be named according to the following format:</p>
|
312
312
|
|
313
|
-
<div class="language-sh highlighter-rouge">
|
314
|
-
|
315
|
-
</code></pre>
|
316
|
-
</div>
|
313
|
+
<div class="language-sh highlighter-rouge"><div class="highlight"><pre class="highlight"><code>YEAR-MONTH-DAY-title.MARKUP
|
314
|
+
</code></pre></div></div>
|
317
315
|
|
318
316
|
<p>Where <code class="highlighter-rouge">YEAR</code> is a four-digit number, <code class="highlighter-rouge">MONTH</code> and <code class="highlighter-rouge">DAY</code> are both two-digit
|
319
317
|
numbers, and <code class="highlighter-rouge">MARKUP</code> is the file extension representing the format used in the
|
320
318
|
file. For example, the following are examples of valid post filenames:</p>
|
321
319
|
|
322
|
-
<div class="language-sh highlighter-rouge">
|
323
|
-
<pre class="highlight"><code>2011-12-31-new-years-eve-is-awesome.md
|
320
|
+
<div class="language-sh highlighter-rouge"><div class="highlight"><pre class="highlight"><code>2011-12-31-new-years-eve-is-awesome.md
|
324
321
|
2012-09-12-how-to-write-a-blog.md
|
325
|
-
</code></pre>
|
326
|
-
</div>
|
322
|
+
</code></pre></div></div>
|
327
323
|
|
328
324
|
<div class="note">
|
329
325
|
<h5>ProTip™: Link to other posts</h5>
|
@@ -375,18 +371,14 @@ variable in a post.</p>
|
|
375
371
|
|
376
372
|
<p>Including an image asset in a post:</p>
|
377
373
|
|
378
|
-
<div class="language-text highlighter-rouge"
|
379
|
-
<pre class="highlight"><code>... which is shown in the screenshot below:
|
374
|
+
<div class="language-text highlighter-rouge"><div class="highlight"><pre class="highlight"><code>... which is shown in the screenshot below:
|
380
375
|
![My helpful screenshot]({{ site.url }}/assets/screenshot.jpg)
|
381
|
-
</code></pre>
|
382
|
-
</div>
|
376
|
+
</code></pre></div></div>
|
383
377
|
|
384
378
|
<p>Linking to a PDF for readers to download:</p>
|
385
379
|
|
386
|
-
<div class="language-text highlighter-rouge"
|
387
|
-
|
388
|
-
</code></pre>
|
389
|
-
</div>
|
380
|
+
<div class="language-text highlighter-rouge"><div class="highlight"><pre class="highlight"><code>... you can [get the PDF]({{ site.url }}/assets/mydoc.pdf) directly.
|
381
|
+
</code></pre></div></div>
|
390
382
|
|
391
383
|
<div class="note">
|
392
384
|
<h5>ProTip™: Link using just the site root URL</h5>
|
@@ -402,8 +394,7 @@ variable in a post.</p>
|
|
402
394
|
|
403
395
|
<p>Jekyll can handle many different iterations of the idea you might associate with a “post,” however a standard blog style post, including a Title, Layout, Publishing Date, and Categories might look like this:</p>
|
404
396
|
|
405
|
-
<div class="highlighter-rouge"
|
406
|
-
<pre class="highlight"><code>---
|
397
|
+
<div class="highlighter-rouge"><div class="highlight"><pre class="highlight"><code>---
|
407
398
|
layout: post
|
408
399
|
title: "Welcome to Jekyll!"
|
409
400
|
date: 2015-11-17 16:16:01 -0600
|
@@ -413,8 +404,7 @@ You’ll find this post in your `_posts` directory. Go ahead and edit it and re-
|
|
413
404
|
|
414
405
|
To add new posts, simply add a file in the `_posts` directory that follows the convention `YYYY-MM-DD-name-of-post.ext` and includes the necessary front matter. Take a look at the source for this post to get an idea about how it works.
|
415
406
|
|
416
|
-
</code></pre>
|
417
|
-
</div>
|
407
|
+
</code></pre></div></div>
|
418
408
|
<p>Everything in between the first and second <code class="highlighter-rouge">---</code> are part of the YAML Front Matter, and everything after the second <code class="highlighter-rouge">---</code> will be rendered with Markdown and show up as “Content.”</p>
|
419
409
|
|
420
410
|
<h2 id="displaying-an-index-of-posts">Displaying an index of posts</h2>
|
@@ -425,16 +415,14 @@ you have a list of posts somewhere. Creating an index of posts on another page
|
|
425
415
|
language</a> and its tags. Here’s a
|
426
416
|
basic example of how to create a list of links to your blog posts:</p>
|
427
417
|
|
428
|
-
<div class="language-html highlighter-rouge">
|
429
|
-
<pre class="highlight"><code><span class="nt"><ul></span>
|
418
|
+
<div class="language-html highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nt"><ul></span>
|
430
419
|
{% for post in site.posts %}
|
431
420
|
<span class="nt"><li></span>
|
432
421
|
<span class="nt"><a</span> <span class="na">href=</span><span class="s">"{{ post.url }}"</span><span class="nt">></span>{{ post.title }}<span class="nt"></a></span>
|
433
422
|
<span class="nt"></li></span>
|
434
423
|
{% endfor %}
|
435
424
|
<span class="nt"></ul></span>
|
436
|
-
</code></pre>
|
437
|
-
</div>
|
425
|
+
</code></pre></div></div>
|
438
426
|
|
439
427
|
<p>Of course, you have full control over how (and where) you display your posts,
|
440
428
|
and how you structure your site. You should read more about <a href="../templates/">how templates
|
@@ -453,8 +441,7 @@ Take the above example of an index of posts. Perhaps you want to include
|
|
453
441
|
a little hint about the post’s content by adding the first paragraph of each of
|
454
442
|
your posts:</p>
|
455
443
|
|
456
|
-
<div class="language-html highlighter-rouge">
|
457
|
-
<pre class="highlight"><code><span class="nt"><ul></span>
|
444
|
+
<div class="language-html highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nt"><ul></span>
|
458
445
|
{% for post in site.posts %}
|
459
446
|
<span class="nt"><li></span>
|
460
447
|
<span class="nt"><a</span> <span class="na">href=</span><span class="s">"{{ post.url }}"</span><span class="nt">></span>{{ post.title }}<span class="nt"></a></span>
|
@@ -462,33 +449,28 @@ your posts:</p>
|
|
462
449
|
<span class="nt"></li></span>
|
463
450
|
{% endfor %}
|
464
451
|
<span class="nt"></ul></span>
|
465
|
-
</code></pre>
|
466
|
-
</div>
|
452
|
+
</code></pre></div></div>
|
467
453
|
|
468
454
|
<p>Because Jekyll grabs the first paragraph you will not need to wrap the excerpt
|
469
455
|
in <code class="highlighter-rouge">p</code> tags, which is already done for you. These tags can be removed with the
|
470
456
|
following if you’d prefer:</p>
|
471
457
|
|
472
|
-
<div class="language-html highlighter-rouge">
|
473
|
-
|
474
|
-
</code></pre>
|
475
|
-
</div>
|
458
|
+
<div class="language-html highlighter-rouge"><div class="highlight"><pre class="highlight"><code>{{ post.excerpt | remove: '<span class="nt"><p></span>' | remove: '<span class="nt"></p></span>' }}
|
459
|
+
</code></pre></div></div>
|
476
460
|
|
477
461
|
<p>If you don’t like the automatically-generated post excerpt, it can be
|
478
462
|
explicitly overridden by adding an <code class="highlighter-rouge">excerpt</code> value to your post’s YAML
|
479
463
|
Front Matter. Alternatively, you can choose to define a custom
|
480
464
|
<code class="highlighter-rouge">excerpt_separator</code> in the post’s YAML front matter:</p>
|
481
465
|
|
482
|
-
<div class="language-text highlighter-rouge"
|
483
|
-
<pre class="highlight"><code>---
|
466
|
+
<div class="language-text highlighter-rouge"><div class="highlight"><pre class="highlight"><code>---
|
484
467
|
excerpt_separator: <!--more-->
|
485
468
|
---
|
486
469
|
|
487
470
|
Excerpt
|
488
471
|
<!--more-->
|
489
472
|
Out-of-excerpt
|
490
|
-
</code></pre>
|
491
|
-
</div>
|
473
|
+
</code></pre></div></div>
|
492
474
|
|
493
475
|
<p>You can also set the <code class="highlighter-rouge">excerpt_separator</code> globally in your <code class="highlighter-rouge">_config.yml</code>
|
494
476
|
configuration file.</p>
|
@@ -507,8 +489,7 @@ html tags along with the content is not desirable.</p>
|
|
507
489
|
either Pygments or Rouge, and including a code snippet in any post is easy.
|
508
490
|
Just use the dedicated Liquid tag as follows:</p>
|
509
491
|
|
510
|
-
<div class="language-text highlighter-rouge">
|
511
|
-
<pre class="highlight"><code>{% highlight ruby %}
|
492
|
+
<div class="language-text highlighter-rouge"><div class="highlight"><pre class="highlight"><code>{% highlight ruby %}
|
512
493
|
def show
|
513
494
|
@widget = Widget(params[:id])
|
514
495
|
respond_to do |format|
|
@@ -517,21 +498,18 @@ def show
|
|
517
498
|
end
|
518
499
|
end
|
519
500
|
{% endhighlight %}
|
520
|
-
</code></pre>
|
521
|
-
</div>
|
501
|
+
</code></pre></div></div>
|
522
502
|
|
523
503
|
<p>And the output will look like this:</p>
|
524
504
|
|
525
|
-
<div class="language-ruby highlighter-rouge">
|
526
|
-
<pre class="highlight"><code><span class="k">def</span> <span class="nf">show</span>
|
505
|
+
<div class="language-ruby highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="k">def</span> <span class="nf">show</span>
|
527
506
|
<span class="vi">@widget</span> <span class="o">=</span> <span class="no">Widget</span><span class="p">(</span><span class="n">params</span><span class="p">[</span><span class="ss">:id</span><span class="p">])</span>
|
528
507
|
<span class="n">respond_to</span> <span class="k">do</span> <span class="o">|</span><span class="nb">format</span><span class="o">|</span>
|
529
508
|
<span class="nb">format</span><span class="p">.</span><span class="nf">html</span> <span class="c1"># show.html.erb</span>
|
530
509
|
<span class="nb">format</span><span class="p">.</span><span class="nf">json</span> <span class="p">{</span> <span class="n">render</span> <span class="ss">json: </span><span class="vi">@widget</span> <span class="p">}</span>
|
531
510
|
<span class="k">end</span>
|
532
511
|
<span class="k">end</span>
|
533
|
-
</code></pre>
|
534
|
-
</div>
|
512
|
+
</code></pre></div></div>
|
535
513
|
|
536
514
|
<div class="note">
|
537
515
|
<h5>ProTip™: Show line numbers</h5>
|