By Kevin McAleer, 3 Minutes
In this lesson, we’ll delve into the heart of managing content in Jekyll. You’ll learn how to create and organize posts and pages, use Markdown for easy content creation, and leverage Jekyll’s front matter and data files for advanced content management.
Jekyll simplifies the process of creating posts and pages. Here’s how you can start:
_posts directory.YYYY-MM-DD-title.md.Start with front matter, for example:
---
layout: post
title: "My First Post"
date: 2024-01-25
categories: tutorial
---
about.md for an About page. Start with front matter too.Markdown is a lightweight markup language that allows you to write using an easy-to-read, easy-to-write plain text format.
# for headings. More #s mean a lower level heading.**bold** for bold text, *italic* for italic text.[Link text](URL) to create hyperlinks. to insert images.Front matter allows you to set variables for your page or post, which you can then access using Jekyll’s templating system.
Example:
---
layout: page
title: "About"
---
_data directory.Liquid Templating
Liquid is a templating language developed by Shopify. Jekyll uses it to process templates, allowing you to use variables, logic, and filters in your content. for example:
{% for item in site.data.mydata %} {{ item.name }} {% endfor %}Note how the logic is wrapped in
{% %}and the variables are wrapped in{{ }}.
In this example, mydata is the name of the data file, and name is a variable in the data file. The for loop iterates through the data file and prints the value of the name variable.
Organizing your content helps visitors navigate your site easily.
Example:
categories: tutorial
tags: jekyll markdown
You now have the knowledge to manage content in Jekyll effectively. Experiment with writing posts, using Markdown, and organizing your site’s content.
Create a blog post about a topic of your choice using Markdown. Include front matter, and categorize and tag your post.
You can use the arrows ← → on your keyboard to navigate between lessons.
Comments