Unit 04 · lesson
`site.posts`, Dates, Categories, and Tags
site.posts, Dates, Categories, and Tags
One post is a file.
Many posts become a content system.
Generate a journal index
Create a page:
---
layout: default
title: Journal
permalink: /journal/
---
<ul>
{% for post in site.posts %}
<li>
<a href="{{ post.url | relative_url }}">{{ post.title }}</a>
<time datetime="{{ post.date | date_to_xmlschema }}">
{{ post.date | date_to_string }}
</time>
</li>
{% endfor %}
</ul>
Build and inspect order.
Categories and tags
Posts can carry classification metadata such as categories and tags.
Example:
categories:
- build-log
tags:
- jekyll
- debugging
Use them because they support navigation/filtering, not because every post needs seven labels.
Dates are data
If a post appears in an unexpected position, inspect:
- filename date;
- front-matter date if set;
- timezone/configuration assumptions;
- generated
post.date.
Guided filtering
Create at least three journal posts and one category/tag distinction.
Use Liquid to display a subset or label them.
Checkpoint
Show one post object flowing through:
_posts file → site.posts → Liquid loop → generated journal link