Jekyll posts
Posts - a quick tutorial
- Create the post document in the folder _posts, name it logically,
- set posts primary keys either:
- in _config.yml, or
- as front matter in the posts document itself,
- set the title and the creation date in the front matter,
- (optionally) include an excerpt key for announcing content,
- add other options in the front matter, including overriding the _config.yml defaults.
For more details read on or visit the Jekyll document on Posts.
Karttur’s categorised posts
This document is itself of the scope pages type. It is the front page (or root) of the posts with categories set to to jekyllposts (but is not itself categorised at all). To end up in the root directory of the posts categorised as jekyllposts, the front matter key permalink is set to /jekyllposts/. The complete front matter of this page thus looks like this (for details on how this defines the layout see the pages document in this site):
layout: single
author_profile: true
permalink: /jekyllposts/
title: "Blog on creating and customising jekyll posts"
toc: false
sidebar:
nav: "jekylldocs"
To list the posts categorised as jekyllposts, the following liquid searches the site and then generates the list of posts seen below - interestingly enough it is not possible to show the liquid syntax - even inside the markers for “text only” the liquid is executed. The text below is the generated html code from the liquid I tried to display:
<ul>
<li>
<a href="/websetup/jekyll/jekyll_posts04-layouts-figures/">Posts in Jekyll: 5. figure</a>
Image header with overlay_color
</li>
<li>
<a href="/websetup/jekyll/jekyll_posts04-layouts-splash/">Posts in Jekyll: 4. splash</a>
The header section of the Splash layout is generated as expected.
</li>
<li>
<a href="/websetup/jekyll/jekyll_posts03-layouts-intro/">Posts in Jekyll: 3. layouts</a>
Introduction to layout options for the theme Minimal Mistakes.
</li>
<li>
<a href="/websetup/jekyll/jekyll_posts02-categories/">Posts in Jekyll: 2. categories</a>
Front matter options for organising posts in categories, forcing urls and omitting posts.
</li>
<li>
<a href="/websetup/jekyll/jekyll_posts01-basics/">Posts in Jekyll: 1. basics</a>
How to set front matter in Jekyll posts and basic options for layout and content using the theme Minimal Mistakes.
</li>
</ul>
Instead I took a screen dump and the image below shows the liquid code that generated the above html (figure 1).
Navigation link
This page is also linked in the top navigation bar of all pages of the blog. This is achieved by the following lines in navigation.yml:
- title: "Posts"
url: /jekyllposts/
description: jekyll posts as part of your site
Posts of categery jekyllposts
- Posts in Jekyll: 5. figure Image header with overlay_color
- Posts in Jekyll: 4. splash The header section of the Splash layout is generated as expected.
- Posts in Jekyll: 3. layouts Introduction to layout options for the theme Minimal Mistakes.
- Posts in Jekyll: 2. categories Front matter options for organising posts in categories, forcing urls and omitting posts.
- Posts in Jekyll: 1. basics How to set front matter in Jekyll posts and basic options for layout and content using the theme Minimal Mistakes.