Setting up the basic project with collections
Let’s start by reviewing what we learned in Chapters 4 and 5 and set up a collection for our photo posts. To get things properly configured, add a new directory in the src
directory and name it posts
. This is where we can store all the posts for the photo blog.
Each post can start with three pieces of frontmatter: title
, description
, and date
:
--- title: This is the first gallery description: This is a gallery of kittens date: "2022-11-01" ---
For our photo site, we’ll deviate a little bit from the traditional way of creating these new posts and instead of putting the Markdown file directly in the posts
directory, we’ll create a subdirectory with the post slug as its name. In that directory, the post will be added with the name index.md
. This will allow us to colocate the post’s images with the post markdown.
Your posts directory should look like the following structure:
- posts ...