jekyll-docs 3.6.0 → 3.6.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (253) hide show
  1. checksums.yaml +4 -4
  2. data/lib/jekyll.rb +195 -0
  3. data/lib/jekyll/cleaner.rb +110 -0
  4. data/lib/jekyll/collection.rb +230 -0
  5. data/lib/jekyll/command.rb +78 -0
  6. data/lib/jekyll/commands/build.rb +102 -0
  7. data/lib/jekyll/commands/clean.rb +43 -0
  8. data/lib/jekyll/commands/doctor.rb +153 -0
  9. data/lib/jekyll/commands/help.rb +34 -0
  10. data/lib/jekyll/commands/new.rb +156 -0
  11. data/lib/jekyll/commands/new_theme.rb +40 -0
  12. data/lib/jekyll/commands/serve.rb +245 -0
  13. data/lib/jekyll/commands/serve/servlet.rb +62 -0
  14. data/lib/jekyll/configuration.rb +410 -0
  15. data/lib/jekyll/converter.rb +54 -0
  16. data/lib/jekyll/converters/identity.rb +23 -0
  17. data/lib/jekyll/converters/markdown.rb +104 -0
  18. data/lib/jekyll/converters/markdown/kramdown_parser.rb +123 -0
  19. data/lib/jekyll/converters/markdown/rdiscount_parser.rb +35 -0
  20. data/lib/jekyll/converters/markdown/redcarpet_parser.rb +108 -0
  21. data/lib/jekyll/converters/smartypants.rb +36 -0
  22. data/lib/jekyll/convertible.rb +251 -0
  23. data/lib/jekyll/deprecator.rb +52 -0
  24. data/lib/jekyll/document.rb +507 -0
  25. data/lib/jekyll/drops/collection_drop.rb +22 -0
  26. data/lib/jekyll/drops/document_drop.rb +69 -0
  27. data/lib/jekyll/drops/drop.rb +214 -0
  28. data/lib/jekyll/drops/excerpt_drop.rb +15 -0
  29. data/lib/jekyll/drops/jekyll_drop.rb +33 -0
  30. data/lib/jekyll/drops/site_drop.rb +47 -0
  31. data/lib/jekyll/drops/static_file_drop.rb +13 -0
  32. data/lib/jekyll/drops/unified_payload_drop.rb +25 -0
  33. data/lib/jekyll/drops/url_drop.rb +88 -0
  34. data/lib/jekyll/entry_filter.rb +123 -0
  35. data/lib/jekyll/errors.rb +20 -0
  36. data/lib/jekyll/excerpt.rb +126 -0
  37. data/lib/jekyll/external.rb +74 -0
  38. data/lib/jekyll/filters.rb +430 -0
  39. data/lib/jekyll/filters/grouping_filters.rb +65 -0
  40. data/lib/jekyll/filters/url_filters.rb +60 -0
  41. data/lib/jekyll/frontmatter_defaults.rb +197 -0
  42. data/lib/jekyll/generator.rb +5 -0
  43. data/lib/jekyll/hooks.rb +104 -0
  44. data/lib/jekyll/layout.rb +62 -0
  45. data/lib/jekyll/liquid_extensions.rb +24 -0
  46. data/lib/jekyll/liquid_renderer.rb +49 -0
  47. data/lib/jekyll/liquid_renderer/file.rb +56 -0
  48. data/lib/jekyll/liquid_renderer/table.rb +96 -0
  49. data/lib/jekyll/log_adapter.rb +147 -0
  50. data/lib/jekyll/mime.types +825 -0
  51. data/lib/jekyll/page.rb +187 -0
  52. data/lib/jekyll/plugin.rb +98 -0
  53. data/lib/jekyll/plugin_manager.rb +113 -0
  54. data/lib/jekyll/publisher.rb +23 -0
  55. data/lib/jekyll/reader.rb +134 -0
  56. data/lib/jekyll/readers/collection_reader.rb +22 -0
  57. data/lib/jekyll/readers/data_reader.rb +77 -0
  58. data/lib/jekyll/readers/layout_reader.rb +71 -0
  59. data/lib/jekyll/readers/page_reader.rb +25 -0
  60. data/lib/jekyll/readers/post_reader.rb +72 -0
  61. data/lib/jekyll/readers/static_file_reader.rb +25 -0
  62. data/lib/jekyll/readers/theme_assets_reader.rb +49 -0
  63. data/lib/jekyll/regenerator.rb +201 -0
  64. data/lib/jekyll/related_posts.rb +52 -0
  65. data/lib/jekyll/renderer.rb +269 -0
  66. data/lib/jekyll/site.rb +471 -0
  67. data/lib/jekyll/static_file.rb +162 -0
  68. data/lib/jekyll/stevenson.rb +61 -0
  69. data/lib/jekyll/tags/highlight.rb +141 -0
  70. data/lib/jekyll/tags/include.rb +215 -0
  71. data/lib/jekyll/tags/link.rb +37 -0
  72. data/lib/jekyll/tags/post_url.rb +103 -0
  73. data/lib/jekyll/theme.rb +68 -0
  74. data/lib/jekyll/theme_builder.rb +119 -0
  75. data/lib/jekyll/url.rb +161 -0
  76. data/lib/jekyll/utils.rb +337 -0
  77. data/lib/jekyll/utils/ansi.rb +59 -0
  78. data/lib/jekyll/utils/exec.rb +27 -0
  79. data/lib/jekyll/utils/platforms.rb +82 -0
  80. data/lib/jekyll/utils/rouge.rb +21 -0
  81. data/lib/jekyll/utils/win_tz.rb +75 -0
  82. data/lib/jekyll/version.rb +5 -0
  83. data/lib/site_template/404.html +24 -0
  84. data/lib/site_template/_config.yml +43 -0
  85. data/lib/site_template/_posts/0000-00-00-welcome-to-jekyll.markdown.erb +25 -0
  86. data/lib/site_template/about.md +18 -0
  87. data/lib/site_template/index.md +6 -0
  88. data/lib/theme_template/CODE_OF_CONDUCT.md.erb +74 -0
  89. data/lib/theme_template/Gemfile +4 -0
  90. data/lib/theme_template/LICENSE.txt.erb +21 -0
  91. data/lib/theme_template/README.md.erb +52 -0
  92. data/lib/theme_template/_layouts/default.html +1 -0
  93. data/lib/theme_template/_layouts/page.html +5 -0
  94. data/lib/theme_template/_layouts/post.html +5 -0
  95. data/lib/theme_template/example/_config.yml.erb +1 -0
  96. data/lib/theme_template/example/_post.md +12 -0
  97. data/lib/theme_template/example/index.html +14 -0
  98. data/lib/theme_template/example/style.scss +7 -0
  99. data/lib/theme_template/gitignore.erb +5 -0
  100. data/lib/theme_template/theme.gemspec.erb +19 -0
  101. metadata +103 -156
  102. data/lib/jekyll-docs.rb +0 -31
  103. data/site/404.html +0 -153
  104. data/site/CNAME +0 -1
  105. data/site/community/index.html +0 -299
  106. data/site/conduct/index.html +0 -10
  107. data/site/css/screen.css +0 -1
  108. data/site/docs/assets/index.html +0 -724
  109. data/site/docs/code_of_conduct/index.html +0 -730
  110. data/site/docs/collections/index.html +0 -1097
  111. data/site/docs/conduct/index.html +0 -744
  112. data/site/docs/configuration/index.html +0 -1403
  113. data/site/docs/continuous-integration/buddyworks/index.html +0 -726
  114. data/site/docs/continuous-integration/circleci/index.html +0 -757
  115. data/site/docs/continuous-integration/index.html +0 -681
  116. data/site/docs/continuous-integration/travis-ci/index.html +0 -891
  117. data/site/docs/contributing/index.html +0 -863
  118. data/site/docs/datafiles/index.html +0 -780
  119. data/site/docs/deployment-methods/index.html +0 -875
  120. data/site/docs/drafts/index.html +0 -636
  121. data/site/docs/extras/index.html +0 -689
  122. data/site/docs/frontmatter/index.html +0 -807
  123. data/site/docs/github-pages/index.html +0 -819
  124. data/site/docs/history/index.html +0 -3955
  125. data/site/docs/home/index.html +0 -644
  126. data/site/docs/includes/index.html +0 -800
  127. data/site/docs/index.html +0 -10
  128. data/site/docs/installation/index.html +0 -732
  129. data/site/docs/maintaining/affinity-team-captain/index.html +0 -706
  130. data/site/docs/maintaining/avoiding-burnout/index.html +0 -709
  131. data/site/docs/maintaining/becoming-a-maintainer/index.html +0 -717
  132. data/site/docs/maintaining/index.html +0 -713
  133. data/site/docs/maintaining/merging-a-pull-request/index.html +0 -747
  134. data/site/docs/maintaining/reviewing-a-pull-request/index.html +0 -725
  135. data/site/docs/maintaining/special-labels/index.html +0 -705
  136. data/site/docs/maintaining/triaging-an-issue/index.html +0 -735
  137. data/site/docs/migrations/index.html +0 -647
  138. data/site/docs/pages/index.html +0 -695
  139. data/site/docs/pagination/index.html +0 -870
  140. data/site/docs/permalinks/index.html +0 -1027
  141. data/site/docs/plugins/index.html +0 -1800
  142. data/site/docs/posts/index.html +0 -858
  143. data/site/docs/quickstart/index.html +0 -650
  144. data/site/docs/resources/index.html +0 -769
  145. data/site/docs/sites/index.html +0 -702
  146. data/site/docs/static-files/index.html +0 -720
  147. data/site/docs/structure/index.html +0 -822
  148. data/site/docs/templates/index.html +0 -1208
  149. data/site/docs/themes/index.html +0 -935
  150. data/site/docs/troubleshooting/index.html +0 -893
  151. data/site/docs/upgrading/0-to-2/index.html +0 -826
  152. data/site/docs/upgrading/2-to-3/index.html +0 -824
  153. data/site/docs/upgrading/index.html +0 -693
  154. data/site/docs/usage/index.html +0 -705
  155. data/site/docs/variables/index.html +0 -1048
  156. data/site/docs/windows/index.html +0 -799
  157. data/site/favicon.ico +0 -0
  158. data/site/feed.xml +0 -372
  159. data/site/fonts/FontAwesome.eot +0 -0
  160. data/site/fonts/FontAwesome.svg +0 -12
  161. data/site/fonts/FontAwesome.ttf +0 -0
  162. data/site/fonts/FontAwesome.woff +0 -0
  163. data/site/github.html +0 -10
  164. data/site/help/index.html +0 -244
  165. data/site/icomoon-selection.json +0 -96
  166. data/site/img/article-footer.png +0 -0
  167. data/site/img/footer-arrow.png +0 -0
  168. data/site/img/footer-logo.png +0 -0
  169. data/site/img/jekyll-sticker.jpg +0 -0
  170. data/site/img/jekylllayoutconcept.png +0 -0
  171. data/site/img/logo-2x.png +0 -0
  172. data/site/img/logo-rss.png +0 -0
  173. data/site/img/octojekyll.png +0 -0
  174. data/site/index.html +0 -267
  175. data/site/issues.html +0 -10
  176. data/site/js/html5shiv.min.js +0 -4
  177. data/site/js/respond.min.js +0 -5
  178. data/site/latest_version.txt +0 -1
  179. data/site/news/2013/05/05/jekyll-1-0-0-released/index.html +0 -570
  180. data/site/news/2013/05/08/jekyll-1-0-1-released/index.html +0 -570
  181. data/site/news/2013/05/12/jekyll-1-0-2-released/index.html +0 -571
  182. data/site/news/2013/06/07/jekyll-1-0-3-released/index.html +0 -568
  183. data/site/news/2013/07/14/jekyll-1-1-0-released/index.html +0 -570
  184. data/site/news/2013/07/24/jekyll-1-1-1-released/index.html +0 -569
  185. data/site/news/2013/07/25/jekyll-1-0-4-released/index.html +0 -565
  186. data/site/news/2013/07/25/jekyll-1-1-2-released/index.html +0 -565
  187. data/site/news/2013/09/06/jekyll-1-2-0-released/index.html +0 -572
  188. data/site/news/2013/09/14/jekyll-1-2-1-released/index.html +0 -566
  189. data/site/news/2013/10/28/jekyll-1-3-0-rc1-released/index.html +0 -564
  190. data/site/news/2013/11/04/jekyll-1-3-0-released/index.html +0 -599
  191. data/site/news/2013/11/26/jekyll-1-3-1-released/index.html +0 -568
  192. data/site/news/2013/12/07/jekyll-1-4-0-released/index.html +0 -583
  193. data/site/news/2013/12/09/jekyll-1-4-1-released/index.html +0 -565
  194. data/site/news/2013/12/16/jekyll-1-4-2-released/index.html +0 -564
  195. data/site/news/2014/01/13/jekyll-1-4-3-released/index.html +0 -573
  196. data/site/news/2014/03/24/jekyll-1-5-0-released/index.html +0 -564
  197. data/site/news/2014/03/27/jekyll-1-5-1-released/index.html +0 -569
  198. data/site/news/2014/05/06/jekyll-turns-2-0-0/index.html +0 -585
  199. data/site/news/2014/05/08/jekyll-2-0-3-released/index.html +0 -565
  200. data/site/news/2014/06/04/jekyll-stickers-1-dollar-stickermule/index.html +0 -567
  201. data/site/news/2014/06/28/jekyll-turns-21-i-mean-2-1-0/index.html +0 -582
  202. data/site/news/2014/07/01/jekyll-2-1-1-released/index.html +0 -579
  203. data/site/news/2014/07/29/jekyll-2-2-0-released/index.html +0 -568
  204. data/site/news/2014/08/10/jekyll-2-3-0-released/index.html +0 -588
  205. data/site/news/2014/09/09/jekyll-2-4-0-released/index.html +0 -574
  206. data/site/news/2014/11/05/jekylls-midlife-crisis-jekyll-turns-2-5-0/index.html +0 -597
  207. data/site/news/2014/11/09/jekyll-2-5-1-released/index.html +0 -575
  208. data/site/news/2014/11/12/jekyll-2-5-2-released/index.html +0 -565
  209. data/site/news/2014/12/17/alfredxing-welcome-to-jekyll-core/index.html +0 -572
  210. data/site/news/2014/12/22/jekyll-2-5-3-released/index.html +0 -567
  211. data/site/news/2015/01/20/jekyll-meet-and-greet/index.html +0 -568
  212. data/site/news/2015/01/24/jekyll-3-0-0-beta1-released/index.html +0 -588
  213. data/site/news/2015/02/26/introducing-jekyll-talk/index.html +0 -563
  214. data/site/news/2015/10/26/jekyll-3-0-released/index.html +0 -592
  215. data/site/news/2015/11/17/jekyll-3-0-1-released/index.html +0 -576
  216. data/site/news/2016/01/20/jekyll-3-0-2-released/index.html +0 -566
  217. data/site/news/2016/01/24/jekyll-3-1-0-released/index.html +0 -599
  218. data/site/news/2016/01/28/jekyll-3-1-1-released/index.html +0 -583
  219. data/site/news/2016/02/08/jekyll-3-0-3-released/index.html +0 -578
  220. data/site/news/2016/02/19/jekyll-3-1-2-released/index.html +0 -569
  221. data/site/news/2016/03/10/making-it-easier-to-contribute-to-jekyll/index.html +0 -565
  222. data/site/news/2016/04/19/jekyll-3-0-4-released/index.html +0 -571
  223. data/site/news/2016/04/19/jekyll-3-1-3-released/index.html +0 -566
  224. data/site/news/2016/04/26/jekyll-3-0-5-released/index.html +0 -572
  225. data/site/news/2016/05/18/jekyll-3-1-4-released/index.html +0 -576
  226. data/site/news/2016/05/18/jekyll-3-1-5-released/index.html +0 -564
  227. data/site/news/2016/05/19/jekyll-3-1-6-released/index.html +0 -566
  228. data/site/news/2016/06/03/update-on-jekyll-s-google-summer-of-code-projects/index.html +0 -567
  229. data/site/news/2016/07/26/jekyll-3-2-0-released/index.html +0 -676
  230. data/site/news/2016/08/02/jekyll-3-2-1-released/index.html +0 -571
  231. data/site/news/2016/08/24/jekyll-admin-initial-release/index.html +0 -566
  232. data/site/news/2016/10/06/jekyll-3-3-is-here/index.html +0 -645
  233. data/site/news/2016/11/14/jekyll-3-3-1-released/index.html +0 -569
  234. data/site/news/2017/01/18/jekyll-3-4-0-released/index.html +0 -592
  235. data/site/news/2017/03/02/jekyll-3-4-1-released/index.html +0 -649
  236. data/site/news/2017/03/09/jekyll-3-4-2-released/index.html +0 -598
  237. data/site/news/2017/03/21/jekyll-3-4-3-released/index.html +0 -594
  238. data/site/news/2017/06/15/jekyll-3-5-0-released/index.html +0 -589
  239. data/site/news/2017/07/17/jekyll-3-5-1-released/index.html +0 -569
  240. data/site/news/2017/08/12/jekyll-3-5-2-released/index.html +0 -573
  241. data/site/news/2017/09/21/jekyll-3-6-0-released/index.html +0 -565
  242. data/site/news/index.html +0 -3609
  243. data/site/news/releases/index.html +0 -3344
  244. data/site/philosophy.html +0 -46
  245. data/site/readme.md +0 -23
  246. data/site/robots.txt +0 -1
  247. data/site/sitemap.xml +0 -485
  248. data/site/tutorials/convert-site-to-jekyll/index.html +0 -793
  249. data/site/tutorials/custom-404-page/index.html +0 -358
  250. data/site/tutorials/home/index.html +0 -323
  251. data/site/tutorials/index.html +0 -10
  252. data/site/tutorials/navigation/index.html +0 -872
  253. data/site/tutorials/orderofinterpretation/index.html +0 -441
@@ -1,793 +0,0 @@
1
- <!DOCTYPE HTML>
2
- <html lang="en-US">
3
- <head>
4
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
5
- <meta charset="UTF-8">
6
- <meta name="viewport" content="width=device-width,initial-scale=1">
7
- <meta name="generator" content="Jekyll v3.6.0">
8
- <link type="application/atom+xml" rel="alternate" href="https://jekyllrb.com/feed.xml" title="Jekyll • Simple, blog-aware, static sites">
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
- <link rel="stylesheet" href="//fonts.googleapis.com/css?family=Lato:300,300italic,400,400italic,700,700italic,900">
11
- <link rel="stylesheet" href="/css/screen.css">
12
- <link rel="icon" type="image/x-icon" href="/favicon.ico">
13
- <!-- Begin Jekyll SEO tag v2.3.0 -->
14
- <title>Convert an HTML site to Jekyll | Jekyll • Simple, blog-aware, static sites</title>
15
- <meta property="og:title" content="Convert an HTML site to Jekyll">
16
- <meta property="og:locale" content="en_US">
17
- <meta name="description" content="If you’re looking for themes for your Jekyll site, you don’t have to restrict yourself to existing Jekyll themes. It’s pretty easy to convert almost any static HTML files into a Jekyll website.">
18
- <meta property="og:description" content="If you’re looking for themes for your Jekyll site, you don’t have to restrict yourself to existing Jekyll themes. It’s pretty easy to convert almost any static HTML files into a Jekyll website.">
19
- <link rel="canonical" href="https://jekyllrb.com/tutorials/convert-site-to-jekyll/">
20
- <meta property="og:url" content="https://jekyllrb.com/tutorials/convert-site-to-jekyll/">
21
- <meta property="og:site_name" content="Jekyll • Simple, blog-aware, static sites">
22
- <meta property="og:type" content="article">
23
- <meta property="article:published_time" content="2017-10-24T08:07:43-07:00">
24
- <meta name="twitter:card" content="summary">
25
- <meta name="twitter:site" content="@jekyllrb">
26
- <meta name="google-site-verification" content="onQcXpAvtHBrUI5LlroHNE_FP0b2qvFyPq7VZw36iEY">
27
- <script type="application/ld+json">
28
- {"name":null,"description":"If you’re looking for themes for your Jekyll site, you don’t have to restrict yourself to existing Jekyll themes. It’s pretty easy to convert almost any static HTML files into a Jekyll website.","url":"https://jekyllrb.com/tutorials/convert-site-to-jekyll/","headline":"Convert an HTML site to Jekyll","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/tutorials/convert-site-to-jekyll/"},"@context":"http://schema.org"}</script>
29
- <!-- End Jekyll SEO tag -->
30
-
31
- <!--[if lt IE 9]>
32
- <script src="/js/html5shiv.min.js"></script>
33
- <script src="/js/respond.min.js"></script>
34
- <![endif]-->
35
- </head>
36
-
37
-
38
- <body class="wrap">
39
- <header>
40
- <nav class="mobile-nav show-on-mobiles">
41
- <ul>
42
- <li class="">
43
- <a href="/">Home</a>
44
- </li>
45
- <li class="">
46
- <a href="/docs/home/">Docs</a>
47
- </li>
48
- <li class="">
49
- <a href="/news/">News</a>
50
- </li>
51
- <li class="">
52
- <a href="/community/">Community</a>
53
- </li>
54
- <li class="">
55
- <a href="/help/">Help</a>
56
- </li>
57
- <li>
58
- <a href="https://github.com/jekyll/jekyll">GitHub</a>
59
- </li>
60
- </ul>
61
-
62
- </nav>
63
- <div class="grid">
64
- <div class="unit one-third center-on-mobiles">
65
- <h1>
66
- <a href="/">
67
- <span class="sr-only">Jekyll</span>
68
- <img src="/img/logo-2x.png" width="249" height="115" alt="Jekyll Logo">
69
- </a>
70
- </h1>
71
- </div>
72
- <nav class="main-nav unit two-thirds hide-on-mobiles">
73
- <ul>
74
- <li class="">
75
- <a href="/">Home</a>
76
- </li>
77
- <li class="">
78
- <a href="/docs/home/">Docs</a>
79
- </li>
80
- <li class="">
81
- <a href="/news/">News</a>
82
- </li>
83
- <li class="">
84
- <a href="/community/">Community</a>
85
- </li>
86
- <li class="">
87
- <a href="/help/">Help</a>
88
- </li>
89
- <li>
90
- <a href="https://github.com/jekyll/jekyll">GitHub</a>
91
- </li>
92
- </ul>
93
-
94
- </nav>
95
- </div>
96
- </header>
97
-
98
-
99
- <section class="docs">
100
- <div class="grid">
101
-
102
- <div class="docs-nav-mobile unit whole show-on-mobiles">
103
- <select onchange="if (this.value) window.location.href=this.value">
104
- <option value="">Navigate the tutorials…</option>
105
-
106
- <optgroup label="Tutorials">
107
-
108
-
109
-
110
- <option value="/tutorials/home/">Tutorials</option>
111
-
112
-
113
-
114
- <option value="/tutorials/navigation/">Navigation</option>
115
-
116
-
117
-
118
- <option value="/tutorials/orderofinterpretation/">Order of interpretation</option>
119
-
120
-
121
-
122
- <option value="/tutorials/custom-404-page/">Custom 404 Page</option>
123
-
124
-
125
-
126
- <option value="/tutorials/convert-site-to-jekyll/">Convert an HTML site to Jekyll</option>
127
-
128
-
129
- </optgroup>
130
-
131
- </select>
132
- </div>
133
-
134
-
135
- <div class="unit four-fifths">
136
- <article>
137
- <div class="improve right hide-on-mobiles">
138
- <a href="https://github.com/jekyll/jekyll/edit/master/docs/_tutorials/convert-existing-site-to-jekyll.md"><i class="fa fa-pencil"></i>  Improve this page</a>
139
- </div>
140
- <h1>Convert an HTML site to Jekyll</h1>
141
- <p>If you’re looking for themes for your Jekyll site, you don’t have to restrict yourself to existing Jekyll themes. It’s pretty easy to convert almost any static HTML files into a Jekyll website.</p>
142
-
143
- <p>In many ways, any site that is currently a static site is <em>already</em> a Jekyll website. Jekyll just allows you to automate parts of the site (like inserting pages into templates, rendering lists for navigation, generating feeds and sitemaps, and more) as it processes the files.</p>
144
-
145
- <p>Understanding how to convert any HTML site into Jekyll templates will open your world to many more options for Jekyll themes. Instead of <a href="https://duckduckgo.com/?q=Jekyll+themes">searching online for <em>Jekyll themes</em></a>, you can choose from the large variety of HTML templates for your site, quickly Jekyll-ize the HTML templates as you need to, and build the output with Jekyll.</p>
146
-
147
- <p>Although websites can have sophisticated features and controls, we’ll keep things simple in this tutorial.</p>
148
-
149
- <h2 id="what-is-a-jekyll-website">What is a Jekyll Website?</h2>
150
-
151
- <p>First, let’s start with a grounding in the basics. Stripping a Jekyll site down to an extremely basic level will help clarify what happens in a Jekyll site. If you haven’t already installed the jekyll gem, <a href="/docs/installation/">install it</a>.</p>
152
-
153
- <p>We’ll start with a <em>basic Jekyll site</em> consisting of three files:</p>
154
-
155
- <div class="highlighter-rouge"><div class="highlight"><pre class="highlight"><code>├── _config.yml
156
- ├── _layouts
157
- │   └── default.html
158
- └── index.md
159
- </code></pre></div></div>
160
-
161
- <p>Manually create these three files in a folder called <code class="highlighter-rouge">my_jekyll_site</code> or whatever suits you the most, and place <code class="highlighter-rouge">default.html</code> inside a folder named <code class="highlighter-rouge">_layouts</code>.</p>
162
-
163
- <div class="language-sh highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nv">$ </span>touch _config.yml index.md default.html
164
- <span class="nv">$ </span>mkdir _layouts <span class="o">&amp;&amp;</span> mv default.html _layouts
165
- </code></pre></div></div>
166
-
167
- <p>Fire up your favorite editor, and populate the contents of the <code class="highlighter-rouge">default.html</code> and <code class="highlighter-rouge">index.md</code> files as follows:</p>
168
-
169
- <p><strong>_config.yml</strong></p>
170
-
171
- <div class="language-yaml highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="na">name</span><span class="pi">:</span> <span class="s">My Jekyll Website</span>
172
- </code></pre></div></div>
173
-
174
- <p><strong>_layouts/default.html</strong></p>
175
-
176
- <div class="language-html highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="cp">&lt;!DOCTYPE html&gt;</span>
177
- <span class="nt">&lt;html&gt;</span>
178
- <span class="nt">&lt;body&gt;</span>
179
- {{ content }}
180
- <span class="nt">&lt;/body&gt;</span>
181
- <span class="nt">&lt;/html&gt;</span>
182
- </code></pre></div></div>
183
-
184
- <p><strong>index.md</strong></p>
185
-
186
- <div class="language-yaml highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nn">---</span>
187
- <span class="na">title</span><span class="pi">:</span> <span class="s">My page</span>
188
- <span class="na">layout</span><span class="pi">:</span> <span class="s">default</span>
189
- <span class="nn">---</span>
190
-
191
- <span class="c1"># {{ page.title }}</span>
192
-
193
- <span class="s">Content is written in [Markdown](https://learnxinyminutes.com/docs/markdown/). Plain text format allows you to focus on your **content**.</span>
194
-
195
- <span class="s">&lt;!--</span>
196
- <span class="s">You can use HTML elements in Markdown, such as the comment element, and they won't be affected by a markdown parser. However, if you create an HTML element in your markdown file, you cannot use markdown syntax within that element's contents.</span>
197
- <span class="s">--&gt;</span>
198
- </code></pre></div></div>
199
-
200
- <p>Now <code class="highlighter-rouge">cd</code> to <code class="highlighter-rouge">my_jekyll_site</code> and serve the site with the built-in server:</p>
201
-
202
- <div class="highlighter-rouge"><div class="highlight"><pre class="highlight"><code>cd my_jekyll_site
203
- jekyll serve
204
- </code></pre></div></div>
205
-
206
- <p class="note info">If you have a Gemfile, <a href="/docs/quickstart/#about-bundler">use Bundler</a> by typing <code class="highlighter-rouge">bundle exec jekyll serve</code> instead.</p>
207
-
208
- <p>When you serve the site, you get a preview URL such as <code class="highlighter-rouge">http://127.0.0.1:4000/</code> (which is the same as <code class="highlighter-rouge">http://localhost:4000/</code>). The site’s files are built into the <code class="highlighter-rouge">_site</code> folder by default.</p>
209
-
210
- <p>This is a Jekyll site at the most basic functional level. Here’s what is happening:</p>
211
-
212
- <ul>
213
- <li>The <code class="highlighter-rouge">_config.yml</code> file contains settings that Jekyll uses as it processes your site. An empty config file will use default values for building a Jekyll site. For example, to convert <a href="https://learnxinyminutes.com/docs/markdown/">Markdown</a> to HTML, Jekyll will automatically use the <a href="https://rubygems.org/gems/kramdown/">kramdown Markdown filter</a>, without any need to specify it.</li>
214
- <li>Jekyll looks for files with <a href="/docs/frontmatter/">front matter tags</a> (the two sets of dashed lines <code class="highlighter-rouge">---</code> like those in <code class="highlighter-rouge">index.md</code>) and processes the files (populating site variables, rendering any <a href="https://shopify.github.io/liquid/">Liquid</a>, and converting Markdown to HTML).</li>
215
- <li>Jekyll pushes the content from all pages and posts into the <code class="highlighter-rouge">{{ content }}</code> variable in the layout specified (<code class="highlighter-rouge">default</code>) in the front matter tags.</li>
216
- <li>The processed files get written as <code class="highlighter-rouge">.html</code> files in the <code class="highlighter-rouge">_site</code> directory.</li>
217
- </ul>
218
-
219
- <p>You can read more about how Jekyll processes the files in <a href="/tutorials/orderofinterpretation/">order of Interpretation</a>.</p>
220
-
221
- <p>With this basic understanding of how a Jekyll site works, you can convert almost any HTML theme for Jekyll. The following sections will take you through a step-by-step tutorial to do so.</p>
222
-
223
- <h2 id="1-create-a-template-for-your-default-layout">1. Create a template for your default layout</h2>
224
-
225
- <p>Find your HTML theme and save it as a <code class="highlighter-rouge">default</code> layout. If you’re converting or cloning an existing site, you can right-click the page and view the source code.</p>
226
-
227
- <p>For example, suppose you’re cloning your company site to create a documentation site with the same branding. Or suppose you have a personal site that you built with HTML and now want to make it a Jekyll site. Get the HTML source code for your site.</p>
228
-
229
- <p class="note info">Regardless of the site, do check the license and make sure you have permission to copy and use the code.</p>
230
-
231
- <p>Copy and paste the source code into a file called <code class="highlighter-rouge">default.html</code>. Put the <code class="highlighter-rouge">default.html</code> file inside the <code class="highlighter-rouge">_layouts</code> folder. This will be the default layout template for your pages and posts — that is, each page or post will use this layout when Jekyll builds the site.</p>
232
-
233
- <p>Note that in looking for templates, you want the HTML output of the template. If the template has PHP tags or other dynamic scripts, these dynamic elements will need to be converted to HTML or to <a href="https://shopify.github.io/liquid/">Liquid</a>. Liquid is <a href="/docs/templates/">Jekyll templating system</a> to retrieve dynamic content.</p>
234
-
235
- <p>Open <code class="highlighter-rouge">default.html</code> into your browser locally to ensure the site looks and behaves like it does online. You will likely need to adjust CSS, JS, and image paths so they work.</p>
236
-
237
- <p>For example, if the paths were relative on the site you copied, you’ll need to either download the same assets into your Jekyll site or use absolute paths to the same assets in the cloud. (Syntax such as <code class="highlighter-rouge">src="//</code> requires a prefix such as <code class="highlighter-rouge">src="http://</code> to work in your local browser.)</p>
238
-
239
- <p>Jekyll provides some <a href="/docs/templates/#filters">filters</a> to prepend a site URL before path. For example, you could preface your stylesheet like this:</p>
240
-
241
- <div class="language-liquid highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="p">{{</span><span class="w"> </span><span class="s2">"/assets/style.css"</span><span class="w"> </span><span class="p">|</span><span class="w"> </span><span class="nf">relative_url</span><span class="w"> </span><span class="p">}}</span>
242
- </code></pre></div></div>
243
-
244
- <p>The <code class="highlighter-rouge">relative_url</code> filter will prepend the <a href="https://byparker.com/blog/2014/clearing-up-confusion-around-baseurl/"><code class="highlighter-rouge">baseurl</code></a> value from your config file (as<code class="highlighter-rouge">blog</code> for instance) to the input. This is useful if your site is hosted at a subpath rather than at the root of the domain (for example, <code class="highlighter-rouge">http://mysite.com/blog/</code>).</p>
245
-
246
- <p>You can also use an <code class="highlighter-rouge">absolute_url</code> filter. This filter will prepend the <code class="highlighter-rouge">url</code> <em>and</em> <code class="highlighter-rouge">baseurl</code> value to the input:</p>
247
-
248
- <div class="language-liquid highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="p">{{</span><span class="w"> </span><span class="s2">"/assets/style.css"</span><span class="w"> </span><span class="p">|</span><span class="w"> </span><span class="nf">absolute_url</span><span class="w"> </span><span class="p">}}</span>
249
- </code></pre></div></div>
250
-
251
- <p>Again, both <code class="highlighter-rouge">url</code> and <code class="highlighter-rouge">baseurl</code> can be defined in your site’s config file, like this:</p>
252
-
253
- <div class="highlighter-rouge"><div class="highlight"><pre class="highlight"><code>url: http://mysite.com
254
- baseurl: /blog
255
- </code></pre></div></div>
256
-
257
- <p>The result in the output will be <code class="highlighter-rouge">http://mysite.com/blog/assets/style.css</code>.</p>
258
-
259
- <p>Note that the <code class="highlighter-rouge">url</code> property of any page begins with a forward slash (<code class="highlighter-rouge">/</code>), so omit this at the end of your <code class="highlighter-rouge">url</code> or <code class="highlighter-rouge">baseurl</code> property.</p>
260
-
261
- <p>You don’t have to prepend filters to link paths like this. You could also use relative links across your entire site. However you decide to code the paths to your assets, make sure they render correctly.</p>
262
-
263
- <p>Does your local <code class="highlighter-rouge">default.html</code> page look good in your browser? Are all images, styles, and other elements showing up correctly? If so, great. Keep going. You can use this template as the layout for all your pages and posts or create as many templates as you need.</p>
264
-
265
- <p>In the next section, you’ll blank out the content of the layout and replace it with placeholder tags that get populated dynamically with your Jekyll pages.</p>
266
-
267
- <h2 id="2-identify-the-content-part-of-the-layout">2. Identify the content part of the layout</h2>
268
-
269
- <p>In <code class="highlighter-rouge">default.html</code>, find where the page content begins (usually at <code class="highlighter-rouge">h1</code> or <code class="highlighter-rouge">h2</code> tags). Replace the title that appears inside these tags with <code class="highlighter-rouge">{{ page.title }}</code>.</p>
270
-
271
- <p>Remove the content part (keep everything else: navigation menu, sidebar, footer, etc.) and replace it with <code class="highlighter-rouge">{{ content }}</code>.</p>
272
-
273
- <p>Check the layout again in your browser and make sure you didn’t corrupt or alter it up by inadvertently removing a crucial <code class="highlighter-rouge">div</code> tag or other element. The only change should be to the title and page content, which are now blanked out or showing the placeholder tag.</p>
274
-
275
- <h2 id="3-create-a-couple-of-files-with-front-matter-tags">3. Create a couple of files with front matter tags</h2>
276
-
277
- <p>Create a couple of files (<code class="highlighter-rouge">index.md</code> and <code class="highlighter-rouge">about.md</code>) in your root directory.</p>
278
-
279
- <p>In your <code class="highlighter-rouge">index.md</code> file, add some front matter tags containing a <code class="highlighter-rouge">title</code> and <code class="highlighter-rouge">layout</code> property, like this:</p>
280
-
281
- <div class="language-yaml highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nn">---</span>
282
- <span class="na">title</span><span class="pi">:</span> <span class="s">Home</span>
283
- <span class="na">layout</span><span class="pi">:</span> <span class="s">default</span>
284
- <span class="nn">---</span>
285
-
286
- <span class="s">Some page content here...</span>
287
- </code></pre></div></div>
288
-
289
- <p>Create another page for testing called <code class="highlighter-rouge">about.md</code> with similar front matter tags.</p>
290
-
291
- <p class="note info">If you don’t specify a layout in your pages, Jekyll will simply render that page as an unstyled basic HTML page.</p>
292
-
293
- <h2 id="4-add-a-configuration-file">4. Add a configuration file</h2>
294
-
295
- <p>Add a <code class="highlighter-rouge">_config.yml</code> file in your root directory. In <code class="highlighter-rouge">_config.yml</code>, you can optionally specify the markdown filter you want. By default, <a href="https://kramdown.gettalong.org/">kramdown</a> is used (without the need to specify it). If no other filter is specified, your config file will automatically apply the following as a default setting:</p>
296
-
297
- <div class="highlighter-rouge"><div class="highlight"><pre class="highlight"><code>markdown: kramdown
298
- </code></pre></div></div>
299
-
300
- <p>You can also specify <a href="https://kramdown.gettalong.org/converter/html.html">some options</a> for kramdown to make it behave more like <a href="https://github.github.com/gfm/">GitHub Flavored Markdown (GFM)</a>:</p>
301
-
302
- <div class="highlighter-rouge"><div class="highlight"><pre class="highlight"><code>kramdown:
303
- input: GFM
304
- auto_ids: true
305
- hard_wrap: false
306
- syntax_highlighter: rouge
307
- </code></pre></div></div>
308
-
309
- <h2 id="5-test-your-pages">5. Test your pages</h2>
310
-
311
- <p>Now run <code class="highlighter-rouge">jekyll serve</code> and toggle between your <code class="highlighter-rouge">index.html</code> and <code class="highlighter-rouge">about.html</code> pages. The default layout should load for both pages.</p>
312
-
313
- <p>You’ve now extracted your content out into separate files and defined a common layout for pages.</p>
314
-
315
- <p>You could define any number of layouts you want for pages. Then just identify the layout you want that particular page to use. For example:</p>
316
-
317
- <div class="highlighter-rouge"><div class="highlight"><pre class="highlight"><code>---
318
- title: Sample page
319
- layout: homepage
320
- ---
321
- </code></pre></div></div>
322
-
323
- <p>This page would then use the <code class="highlighter-rouge">homepage.html</code> template in the <code class="highlighter-rouge">_layouts</code> folder.</p>
324
-
325
- <p>You can even set <a href="/docs/configuration/#front-matter-defaults">default front matter tags</a> for pages, posts, or <a href="/docs/collections/">collections</a> in your <code class="highlighter-rouge">_config.yml</code> file so that you don’t have to specify the layout in the front matter variables. Anywayd, setting defaults is beyond the scope of this tutorial, let’s get back to work.</p>
326
-
327
- <h2 id="6-configure-site-variables">6. Configure site variables</h2>
328
-
329
- <p>You already configured the page title using <code class="highlighter-rouge">{{ page.title }}</code> tags. But there are more <code class="highlighter-rouge">title</code> tags to populate. Pages also have a <a href="https://moz.com/learn/seo/title-tag"><code class="highlighter-rouge">title</code></a> tag that appears in the browser tab or window. Typically you put the page title followed by the site title here.</p>
330
-
331
- <p>In your <code class="highlighter-rouge">default.html</code> layout, look for the <code class="highlighter-rouge">title</code> tags below your <code class="highlighter-rouge">head</code> tags:</p>
332
-
333
- <div class="highlighter-rouge"><div class="highlight"><pre class="highlight"><code>&lt;title&gt;ACME Website&lt;/title&gt;
334
- </code></pre></div></div>
335
-
336
- <p>Insert the following site variables:</p>
337
-
338
- <div class="highlighter-rouge"><div class="highlight"><pre class="highlight"><code>&lt;title&gt;{{ page.title }} | {{ site.title }}&lt;/title&gt;
339
- </code></pre></div></div>
340
-
341
- <p>Open <code class="highlighter-rouge">_config.yml</code> and add a <code class="highlighter-rouge">title</code> property for your site’s name.</p>
342
-
343
- <div class="highlighter-rouge"><div class="highlight"><pre class="highlight"><code>title: ACME Website
344
- </code></pre></div></div>
345
-
346
- <p>Any properties you add in your <code class="highlighter-rouge">_config.yml</code> file are accessible through the <code class="highlighter-rouge">site</code> namespace. Similarly, any properties in your page’s front matter are accessible through the <code class="highlighter-rouge">page</code> namespace. Use dot notation after <code class="highlighter-rouge">site</code> or <code class="highlighter-rouge">page</code> to access the value.</p>
347
-
348
- <p>Stop your Jekyll server with <kbd>Ctrl</kbd> + <kbd>C</kbd> and restart it. Verify that the <code class="highlighter-rouge">title</code> tags are populating correctly.</p>
349
-
350
- <p class="note info">Every time you modify your config file, you have to restart Jekyll for the changes to take effect. When you modify other files, Jekyll automatically picks up the changes when it rebuilds.</p>
351
-
352
- <p>If you have other variables to populate in your site, rinse and repeat.</p>
353
-
354
- <h2 id="7-show-posts-on-a-page">7. Show posts on a page</h2>
355
-
356
- <p>It’s common to show a list of posts on the homepage. First, let’s create some posts so that we have something to showcase.</p>
357
-
358
- <p>Add some posts in a <code class="highlighter-rouge">_posts</code> folder following the standard <code class="highlighter-rouge">YYYY-MM-DD-title.md</code> post format:</p>
359
-
360
- <ul>
361
- <li><code class="highlighter-rouge">2017-01-02-my-first-post.md</code></li>
362
- <li><code class="highlighter-rouge">2017-01-15-my-second-post.md</code></li>
363
- <li><code class="highlighter-rouge">2017-02-08-my-third-post.md</code></li>
364
- </ul>
365
-
366
- <p>In each post, add some basic content:</p>
367
-
368
- <div class="highlighter-rouge"><div class="highlight"><pre class="highlight"><code>---
369
- title: My First Post
370
- layout: default
371
- ---
372
-
373
- Some sample content...
374
- </code></pre></div></div>
375
-
376
- <p>Now let’s create a layout that will display the posts. Create a new file in <code class="highlighter-rouge">_layouts</code> called <code class="highlighter-rouge">home.html</code> and add the following logic:</p>
377
-
378
- <div class="highlighter-rouge"><div class="highlight"><pre class="highlight"><code>---
379
- layout: default
380
- ---
381
-
382
- {{ content }}
383
- &lt;ul class="myposts"&gt;
384
- {% for post in site.posts %}
385
- &lt;li&gt;&lt;a href="{{ post.url }}"&gt;{{ post.title}}&lt;/a&gt;
386
- &lt;span class="postDate"&gt;{{ post.date | date: "%b %-d, %Y" }}&lt;/span&gt;
387
- &lt;/li&gt;
388
- {% endfor %}
389
- &lt;/ul&gt;
390
- </code></pre></div></div>
391
-
392
- <p>Create a file called <code class="highlighter-rouge">blog.md</code> in your root directory and specify the <code class="highlighter-rouge">home</code> layout:</p>
393
-
394
- <div class="highlighter-rouge"><div class="highlight"><pre class="highlight"><code>---
395
- title: Blog
396
- layout: home
397
- ---
398
- </code></pre></div></div>
399
-
400
- <p>In this case, contents of <code class="highlighter-rouge">blog.md</code> will be pushed into the <code class="highlighter-rouge">{{ content }}</code> tag in the <code class="highlighter-rouge">home</code> layout. Then the <code class="highlighter-rouge">home</code> layout will be pushed into the <code class="highlighter-rouge">{{ content }}</code> tag of the <code class="highlighter-rouge">default</code> layout.</p>
401
-
402
- <h3 id="how-layouts-work">How layouts work</h3>
403
-
404
- <p>When a layout specifies another layout, it means the content of the first layout will be stuffed into the <code class="highlighter-rouge">{{ content }}</code> tag of the second layout. As an analogy, think of Russian dolls that fit into each other. Each layout fits into another layout that it specifies.</p>
405
-
406
- <p>The following diagram shows how layouts work in Jekyll:</p>
407
-
408
- <p><img src="../../img/jekylllayoutconcept.png" alt="Concept of Jekyll layouts"></p>
409
-
410
- <p class="image-description">In this example, the content from a Markdown document <code class="highlighter-rouge">document.md</code> that specifies <code class="highlighter-rouge">layout: docs</code> gets pushed into the <code class="highlighter-rouge">{{ content }}</code> tag of the layout file <code class="highlighter-rouge">docs.html</code>. Because the <code class="highlighter-rouge">docs</code> layout itself specifies <code class="highlighter-rouge">layout: page</code>, the content from <code class="highlighter-rouge">docs.html</code> gets pushed into the <code class="highlighter-rouge">{{ content }}</code> tag in the layout file <code class="highlighter-rouge">page.html</code>. Finally because the <code class="highlighter-rouge">page</code> layout specifies <code class="highlighter-rouge">layout: default</code>, the content from <code class="highlighter-rouge">page.html</code> gets pushed into the <code class="highlighter-rouge">{{ content }}</code> tag of the layout file <code class="highlighter-rouge">default.html</code>.</p>
411
-
412
- <p>You don’t need multiple layouts. You could just use one: <code class="highlighter-rouge">default</code>. You have options for how you design your site. In general, it’s common to define one layout for pages and another layout for posts, but for both of these layouts to inherit the <code class="highlighter-rouge">default</code> template (which usually defines the top and bottom parts of the site).</p>
413
-
414
- <p>In your browser, go to <code class="highlighter-rouge">blog.html</code> and see the list of posts.
415
- Note that you don’t have to use the method described here. You could have simply added the <code class="highlighter-rouge">for</code> loop to any page, such as <code class="highlighter-rouge">index.md</code>, to display these posts. But given that you may have more complex logic for other features, it can be helpful to store your logic in templates separate from the page area where you frequently type your content.</p>
416
-
417
- <p class="note info">At minimum, a layout should contain <code class="highlighter-rouge">{{ content }}</code>, which acts as a receiver for the <em>content</em> to be rendered.</p>
418
-
419
- <h3 id="for-loops">For loops</h3>
420
-
421
- <p>By the way, let’s pause here to look at the <code class="highlighter-rouge">for</code> loop logic a little more closely. <a href="https://help.shopify.com/themes/liquid/tags/iteration-tags#for">For loops in Liquid</a> are one of the most commonly used Liquid tags. <em>For loops</em> let you iterate through content in your Jekyll site and build out a result. The <code class="highlighter-rouge">for</code> loop also has <a href="https://help.shopify.com/themes/liquid/objects/for-loops">certain properties available</a> (like first or last iteration) based on the loop’s position in the loop as well.</p>
422
-
423
- <p>We’ve only scratched the surface of what you can do with <code class="highlighter-rouge">for</code> loops in retrieving posts. For example, if you wanted to display posts from a specific category, you could do so by adding a <code class="highlighter-rouge">categories</code> property to your post’s front matter and then look in those categories. Further, you could limit the number of results by adding a <code class="highlighter-rouge">limit</code> property. Here’s an example:</p>
424
-
425
- <div class="language-liquid highlighter-rouge"><div class="highlight"><pre class="highlight"><code>&lt;ul class="myposts"&gt;
426
- <span class="p">{%</span><span class="w"> </span><span class="nt">for</span><span class="w"> </span>post<span class="w"> </span>in<span class="w"> </span>site.categories.podcasts<span class="w"> </span><span class="na">limit</span><span class="o">:</span><span class="mi">3</span><span class="w"> </span><span class="p">%}</span>
427
- &lt;li&gt;&lt;a href="<span class="p">{{</span><span class="w"> </span><span class="nv">post</span><span class="p">.</span><span class="nv">url</span><span class="w"> </span><span class="p">}}</span>"&gt;<span class="p">{{</span><span class="w"> </span><span class="nv">post</span><span class="p">.</span><span class="nv">title</span><span class="p">}}</span>&lt;/a&gt;
428
- &lt;span class="postDate"&gt;<span class="p">{{</span><span class="w"> </span><span class="nv">post</span><span class="p">.</span><span class="nv">date</span><span class="w"> </span><span class="p">|</span><span class="w"> </span><span class="nf">date</span><span class="p">:</span><span class="w"> </span><span class="s2">"%b %-d, %Y"</span><span class="w"> </span><span class="p">}}</span>&lt;/span&gt;
429
- &lt;/li&gt;
430
- <span class="p">{%</span><span class="w"> </span><span class="nt">endfor</span><span class="w"> </span><span class="p">%}</span>
431
- </code></pre></div></div>
432
-
433
- <p>This loop would get the latest three posts that have a category called <code class="highlighter-rouge">podcasts</code> in the front matter.</p>
434
-
435
- <h2 id="8-configure-navigation">8. Configure navigation</h2>
436
-
437
- <p>Now that you’ve configured posts, let’s configure page navigation. Most websites have some navigation either in the sidebar or header area.</p>
438
-
439
- <p>In this tutorial, we’ll assume you’ve got a simple list of pages you want to generate. If you only have a handful of pages, you could list them by using a <code class="highlighter-rouge">for</code> loop to iterate through the <code class="highlighter-rouge">site.pages</code> object and then order them by a front matter property.</p>
440
-
441
- <p>Identify the part of your code where the list of pages appears. Usually this is a <code class="highlighter-rouge">&lt;ul&gt;</code> element with various child <code class="highlighter-rouge">&lt;li&gt;</code> elements. Replace the code with the following:</p>
442
-
443
- <div class="language-html highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nt">&lt;ul&gt;</span>
444
- {% assign mypages = site.pages | sort: "order" %}
445
- {% for page in mypages %}
446
- <span class="nt">&lt;li&gt;&lt;a</span> <span class="na">href=</span><span class="s">"{{ page.url | absolute_url }}"</span><span class="nt">&gt;</span>{{ page.title }}<span class="nt">&lt;/a&gt;&lt;/li&gt;</span>
447
- {% endfor %}
448
- <span class="nt">&lt;/ul&gt;</span>
449
- </code></pre></div></div>
450
-
451
- <p>This example assumes each page would have front matter containing both a <code class="highlighter-rouge">title</code> and <code class="highlighter-rouge">order</code> property like this:</p>
452
-
453
- <div class="highlighter-rouge"><div class="highlight"><pre class="highlight"><code>---
454
- title: My page
455
- order: 2
456
- ---
457
- </code></pre></div></div>
458
-
459
- <p>Here the <code class="highlighter-rouge">order</code> property will define how the pages get sorted, with <code class="highlighter-rouge">1</code> appearing first in the list.</p>
460
-
461
- <p>You could also iterate through a list of pages that you maintain in a separate data file. This might be more appropriate if you have a lot of pages, or you have other properties about the pages you want to store.</p>
462
-
463
- <p>To manage page links this way, create a folder in your Jekyll project called <code class="highlighter-rouge">_data</code>. In this folder, create a file called e.g. <code class="highlighter-rouge">navigation.yml</code> with this content:</p>
464
-
465
- <div class="language-yaml highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="pi">-</span> <span class="na">title</span><span class="pi">:</span> <span class="s">Sample page 1</span>
466
- <span class="na">url</span><span class="pi">:</span> <span class="s">/page-1-permalink/</span>
467
-
468
- <span class="pi">-</span> <span class="na">title</span><span class="pi">:</span> <span class="s">Sample page 2</span>
469
- <span class="na">url</span><span class="pi">:</span> <span class="s">/page-2-permalink/</span>
470
-
471
- <span class="pi">-</span> <span class="na">title</span><span class="pi">:</span> <span class="s">Sample page 3</span>
472
- <span class="na">url</span><span class="pi">:</span> <span class="s">/page-3-permalink/</span>
473
- </code></pre></div></div>
474
-
475
- <p class="note info">If you never wrote any YAML before, you’ll get quickly familiar with it. Take a look at <a href="https://learnxinyminutes.com/docs/yaml/">what you can do with YAML</a>.</p>
476
-
477
- <p>You can store additional properties for each item in this data file as desired. Arrange the list items in the order you want them to appear.</p>
478
-
479
- <p>To print the list of pages from the data file, use code like this:</p>
480
-
481
- <div class="language-html highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nt">&lt;ul&gt;</span>
482
- {% for link in site.data.navigation %}
483
- <span class="nt">&lt;li&gt;&lt;a</span> <span class="na">href=</span><span class="s">"{{ link.url }}"</span><span class="nt">&gt;</span>{{ link.title }}<span class="nt">&lt;/a&gt;&lt;/li&gt;</span>
484
- {% endfor %}
485
- <span class="nt">&lt;/ul&gt;</span>
486
- </code></pre></div></div>
487
-
488
- <p>If you have more sophisticated requirements around navigation, such as when building a documentation site, see the <a href="/tutorials/navigation/">detailed tutorial on navigation</a>.</p>
489
-
490
- <h2 id="9-simplify-your-site-with-includes">9. Simplify your site with includes</h2>
491
-
492
- <p>Let’s suppose your <code class="highlighter-rouge">default.html</code> file is massive and hard to work with. You can break up your layout by putting some of the HTML code in <em>include</em> files.</p>
493
-
494
- <p>Add a folder called <code class="highlighter-rouge">_includes</code> in your root directory. In that folder, add a file there called <code class="highlighter-rouge">sidebar.html</code>.</p>
495
-
496
- <p>Remove your sidebar code from your <code class="highlighter-rouge">default.html</code> layout and insert it into the <code class="highlighter-rouge">sidebar.html</code> file.</p>
497
-
498
- <p>Where the sidebar code previously existed in <code class="highlighter-rouge">default.html</code>, pull in your “include” like this:</p>
499
-
500
- <div class="language-liquid highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="p">{%</span><span class="w"> </span><span class="nt">include</span><span class="w"> </span><span class="na">sidebar</span><span class="p">.</span><span class="na">html</span><span class="w"> </span><span class="p">%}</span>
501
- </code></pre></div></div>
502
-
503
- <p>You can break up other elements of your theme like this, such as your header or footer. Then you can apply these common elements to other layout files. This way you won’t have duplicate code.</p>
504
-
505
- <h2 id="10-rss-feed">10. RSS feed</h2>
506
-
507
- <p>Your Jekyll site needs an RSS feed. Here’s the <a href="http://www.w3schools.com/xml/xml_rss.asp">basic RSS feed syntax</a>. To create an RSS file in Jekyll, create a file called <code class="highlighter-rouge">feed.xml</code> in your root directory and add the following:</p>
508
-
509
- <div class="language-xml highlighter-rouge"><div class="highlight"><pre class="highlight"><code>---
510
- layout: null
511
- ---
512
-
513
- <span class="cp">&lt;?xml version="1.0" encoding="UTF-8" ?&gt;</span>
514
- <span class="nt">&lt;rss</span> <span class="na">version=</span><span class="s">"2.0"</span><span class="nt">&gt;</span>
515
-
516
- <span class="nt">&lt;channel&gt;</span>
517
- <span class="nt">&lt;title&gt;</span>{{ site.title }}<span class="nt">&lt;/title&gt;</span>
518
- <span class="nt">&lt;link&gt;</span>{{ site.url }}<span class="nt">&lt;/link&gt;</span>
519
- <span class="nt">&lt;description&gt;</span>{{ site.description }}<span class="nt">&lt;/description&gt;</span>
520
- <span class="nt">&lt;lastBuildDate&gt;</span>{{ site.time | date_to_rfc822 }}<span class="nt">&lt;/lastBuildDate&gt;</span>
521
- {% for post in site.posts %}
522
- <span class="nt">&lt;item&gt;</span>
523
- <span class="nt">&lt;description&gt;</span>
524
- {{ post.content | escape | truncate: '400' }}
525
- <span class="nt">&lt;/description&gt;</span>
526
- <span class="nt">&lt;pubDate&gt;</span>{{ post.date | date_to_rfc822 }}<span class="nt">&lt;/pubDate&gt;</span>
527
- <span class="nt">&lt;guid&gt;</span>
528
- {{ post.url | prepend: site.url }}
529
- <span class="nt">&lt;/guid&gt;</span>
530
- <span class="nt">&lt;/item&gt;</span>
531
- {% endfor %}
532
- <span class="nt">&lt;/channel&gt;</span>
533
- <span class="nt">&lt;/rss&gt;</span>
534
- </code></pre></div></div>
535
-
536
- <p>Make sure your <code class="highlighter-rouge">_config.yml</code> file has properties for <code class="highlighter-rouge">title</code>, <code class="highlighter-rouge">url</code>, and <code class="highlighter-rouge">description</code>.</p>
537
-
538
- <p>This code uses a <code class="highlighter-rouge">for</code> loop to look through your last 20 posts. The content from the posts gets escaped and truncated to the last 400 characters using <a href="https://help.shopify.com/themes/liquid/filters">Liquid filters</a>.</p>
539
-
540
- <p>In your <code class="highlighter-rouge">default.html</code> layout, look for a reference to the RSS or Atom feed in your header, and replace it with a reference to the file you just created. For example:</p>
541
-
542
- <div class="language-html highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nt">&lt;link</span> <span class="na">rel=</span><span class="s">"alternate"</span> <span class="na">type=</span><span class="s">"application/rss+xml"</span> <span class="na">href=</span><span class="s">"{{ site.url }}/feed.xml"</span> <span class="na">title=</span><span class="s">"{{ site.title }}"</span><span class="nt">&gt;</span>
543
- </code></pre></div></div>
544
-
545
- <p>You can also auto-generate your posts feed by adding a gem called <a href="https://help.github.com/articles/atom-rss-feeds-for-github-pages/"><code class="highlighter-rouge">jekyll-feed</code></a>. This gem will also work on GitHub Pages.</p>
546
-
547
- <h2 id="11-add-a-sitemap">11. Add a sitemap</h2>
548
-
549
- <p>Finally, add a <a href="https://www.sitemaps.org/protocol.html">site map</a>. Create a <code class="highlighter-rouge">sitemap.xml</code> file in your root directory and add this code:</p>
550
-
551
- <div class="language-xml highlighter-rouge"><div class="highlight"><pre class="highlight"><code>---
552
- layout: null
553
- search: exclude
554
- ---
555
-
556
- <span class="cp">&lt;?xml version="1.0" encoding="UTF-8"?&gt;</span>
557
- <span class="nt">&lt;urlset</span> <span class="na">xmlns=</span><span class="s">"http://www.sitemaps.org/schemas/sitemap/0.9"</span><span class="nt">&gt;</span>
558
-
559
- {% for page in site.pages %}
560
- <span class="nt">&lt;url&gt;</span>
561
- <span class="nt">&lt;loc&gt;</span>{{page.url}}<span class="nt">&lt;/loc&gt;</span>
562
- <span class="nt">&lt;lastmod&gt;</span>{{site.time | date: '%Y-%m-%d' }}<span class="nt">&lt;/lastmod&gt;</span>
563
- <span class="nt">&lt;changefreq&gt;</span>daily<span class="nt">&lt;/changefreq&gt;</span>
564
- <span class="nt">&lt;priority&gt;</span>0.5<span class="nt">&lt;/priority&gt;</span>
565
- <span class="nt">&lt;/url&gt;</span>
566
- {% endfor %}
567
-
568
- {% for post in site.posts %}
569
- <span class="nt">&lt;url&gt;</span>
570
- <span class="nt">&lt;loc&gt;</span>{{post.url}}<span class="nt">&lt;/loc&gt;</span>
571
- <span class="nt">&lt;lastmod&gt;</span>{{site.time | date: '%Y-%m-%d' }}<span class="nt">&lt;/lastmod&gt;</span>
572
- <span class="nt">&lt;changefreq&gt;</span>daily<span class="nt">&lt;/changefreq&gt;</span>
573
- <span class="nt">&lt;priority&gt;</span>0.5<span class="nt">&lt;/priority&gt;</span>
574
- <span class="nt">&lt;/url&gt;</span>
575
- {% endfor %}
576
-
577
- <span class="nt">&lt;/urlset&gt;</span>
578
- </code></pre></div></div>
579
-
580
- <p>Again, we’re using a <code class="highlighter-rouge">for</code> loop here to iterate through all posts and pages to add them to the sitemap.</p>
581
-
582
- <p>You can also auto-generate your sitemap by adding a gem called <a href="https://help.github.com/articles/sitemaps-for-github-pages/"><code class="highlighter-rouge">jekyll-sitemap</code></a>. This gem will also work on GitHub Pages.</p>
583
-
584
- <h2 id="12-add-external-services">12. Add external services</h2>
585
-
586
- <p>For other services you might need (such as contact forms, search, comments, and more), look for third-party services. For example, you might use the following:</p>
587
-
588
- <ul>
589
- <li>For comments: <a href="https://disqus.com/">Disqus</a>
590
- </li>
591
- <li>For a newsletter: <a href="https://tinyletter.com/">Tinyletter</a>
592
- </li>
593
- <li>For contact forms: <a href="https://www.wufoo.com/">Wufoo</a>
594
- </li>
595
- <li>For search: <a href="https://community.algolia.com/docsearch/">Algolia Docsearch</a>
596
- </li>
597
- </ul>
598
-
599
- <p>For more details on services for static sites, see the <a href="https://learn.cloudcannon.com/jekyll-third-parties/">Third Parties</a> list and tutorials from CloudCannon.</p>
600
-
601
- <p>Your Jekyll pages consist of HTML, CSS, and JavaScript, so pretty much any code you need to embed will work without a problem.</p>
602
-
603
- <p>As you integrate code for these services, note that <strong>if a page in your Jekyll site doesn’t have front matter tags, Jekyll won’t process any of the content in that page.</strong> The page will just be passed to the <code class="highlighter-rouge">_site</code> folder when you build your site.</p>
604
-
605
- <p>If you do want Jekyll to process some page content (for example, to populate a variable that you define in your site’s config file), just add front matter tags to the page. If you don’t want any layout applied to the page, specify <code class="highlighter-rouge">layout: null</code> like this:</p>
606
-
607
- <div class="highlighter-rouge"><div class="highlight"><pre class="highlight"><code>---
608
- layout: null
609
- ---
610
- </code></pre></div></div>
611
-
612
- <h2 id="13-conclusion">13. Conclusion</h2>
613
-
614
- <p>Although websites can implement more sophisticated features and functionality, we’ve covered the basics in this tutorial. You now have a fully functional Jekyll site.</p>
615
-
616
- <p>To deploy your site, consider using <a href="https://pages.github.com/">GitHub Pages</a>, <a href="https://www.netlify.com/">Netlify</a>, <a href="https://aws.amazon.com/s3/">Amazon AWS S3</a> using the <a href="https://github.com/laurilehmijoki/s3_website">s3_website plugin</a>, or just FTP your files to your web server.</p>
617
-
618
- <p>You can also package your layouts, includes and assets into a Ruby <code class="highlighter-rouge">gem</code> and <a href="/docs/themes/#creating-a-theme">make it a Jekyll theme</a>.</p>
619
-
620
- <h2 id="additional-resources">Additional resources</h2>
621
-
622
- <p>Here are some additional tutorials on creating Jekyll sites:</p>
623
-
624
- <ul>
625
- <li><a href="http://jekyll.tips/jekyll-casts/converting-a-static-site-to-jekyll/">Convert a static site to Jekyll</a></li>
626
- <li><a href="https://css-tricks.com/building-a-jekyll-site-part-1-of-3/">Building a Jekyll Site – Part 1 of 3: Converting a Static Website To Jekyll</a></li>
627
- </ul>
628
-
629
-
630
-
631
-
632
-
633
-
634
-
635
-
636
-
637
-
638
-
639
-
640
-
641
-
642
-
643
-
644
-
645
-
646
-
647
-
648
-
649
-
650
- <div class="section-nav">
651
- <div class="left align-right">
652
-
653
-
654
-
655
- <a href="/tutorials/custom-404-page/" class="prev">Back</a>
656
-
657
- </div>
658
- <div class="right align-left">
659
-
660
- <span class="next disabled">Next</span>
661
-
662
- </div>
663
- </div>
664
- <div class="clear"></div>
665
-
666
- </article>
667
- </div>
668
-
669
- <div class="unit one-fifth hide-on-mobiles">
670
- <aside>
671
-
672
- <h4>Tutorials</h4>
673
-
674
- <ul>
675
-
676
-
677
-
678
- <li class=""><a href="/tutorials/home/">Tutorials</a></li>
679
-
680
-
681
-
682
- <li class=""><a href="/tutorials/navigation/">Navigation</a></li>
683
-
684
-
685
-
686
- <li class=""><a href="/tutorials/orderofinterpretation/">Order of interpretation</a></li>
687
-
688
-
689
-
690
- <li class=""><a href="/tutorials/custom-404-page/">Custom 404 Page</a></li>
691
-
692
-
693
-
694
- <li class="current"><a href="/tutorials/convert-site-to-jekyll/">Convert an HTML site to Jekyll</a></li>
695
-
696
- </ul>
697
-
698
-
699
-
700
- </aside>
701
- </div>
702
-
703
-
704
- <div class="clear"></div>
705
-
706
- </div>
707
- </section>
708
-
709
-
710
- <footer>
711
- <div class="grid">
712
- <div class="unit one-third center-on-mobiles">
713
- <p>The contents of this website are <br>© 2017 under the terms of the <a href="https://github.com/jekyll/jekyll/blob/master/LICENSE">MIT License</a>.</p>
714
- </div>
715
- <div class="unit two-thirds align-right center-on-mobiles">
716
- <p>
717
- Proudly hosted by
718
- <a href="https://github.com">
719
- <img src="/img/footer-logo.png" width="100" height="30" alt="GitHub • Social coding">
720
- </a>
721
- </p>
722
- </div>
723
- </div>
724
- </footer>
725
-
726
- <script>
727
- var anchorForId = function (id) {
728
- var anchor = document.createElement("a");
729
- anchor.className = "header-link";
730
- anchor.href = "#" + id;
731
- anchor.innerHTML = "<span class=\"sr-only\">Permalink</span><i class=\"fa fa-link\"></i>";
732
- anchor.title = "Permalink";
733
- return anchor;
734
- };
735
-
736
- var linkifyAnchors = function (level, containingElement) {
737
- var headers = containingElement.getElementsByTagName("h" + level);
738
- for (var h = 0; h < headers.length; h++) {
739
- var header = headers[h];
740
-
741
- if (typeof header.id !== "undefined" && header.id !== "") {
742
- header.appendChild(anchorForId(header.id));
743
- }
744
- }
745
- };
746
-
747
- document.onreadystatechange = function () {
748
- if (this.readyState === "complete") {
749
- var contentBlock = document.getElementsByClassName("docs")[0] || document.getElementsByClassName("news")[0];
750
- if (!contentBlock) {
751
- return;
752
- }
753
- for (var level = 1; level <= 6; level++) {
754
- linkifyAnchors(level, contentBlock);
755
- }
756
- }
757
- };
758
- </script>
759
-
760
-
761
- <!-- Gauges (http://get.gaug.es/) -->
762
- <script>
763
- var _gauges = _gauges || [];
764
- (function() {
765
- var t = document.createElement('script');
766
- t.type = 'text/javascript';
767
- t.async = true;
768
- t.id = 'gauges-tracker';
769
- t.setAttribute('data-site-id', '503c5af6613f5d0f19000027');
770
- t.src = '//secure.gaug.es/track.js';
771
- var s = document.getElementsByTagName('script')[0];
772
- s.parentNode.insertBefore(t, s);
773
- })();
774
- </script>
775
-
776
-
777
-
778
- <!-- Google Analytics (https://www.google.com/analytics) -->
779
- <script>
780
- !function(j,e,k,y,l,L){j.GoogleAnalyticsObject=y,j[y]||(j[y]=function(){
781
- (j[y].q=j[y].q||[]).push(arguments)}),j[y].l=+new Date,l=e.createElement(k),
782
- L=e.getElementsByTagName(k)[0],l.src='//www.google-analytics.com/analytics.js',
783
- L.parentNode.insertBefore(l,L)}(window,document,'script','ga');
784
-
785
- ga('create', 'UA-50755011-1', 'jekyllrb.com');
786
- ga('send', 'pageview');
787
-
788
- </script>
789
-
790
-
791
-
792
- </body>
793
- </html>