Creating a collection with directory data and Markdown
To start, let’s create a new directory in our src
folder named posts
. This will be the directory that houses all the blog posts for our blog. Once that directory is created, add two Markdown files to the directory. The names of these files will, by default, be the URL for each post, so name them accordingly. For my posts, I’ll use my-first-blog-post.md
and my-second-blog-post.md
– creative, I know.
Inside these files, we need a little bit of frontmatter and then the content written in Markdown. All Markdown is acceptable, but keep in mind the template we’ll create will already have an <h1>
, so it’s best not to have one in the content for SEO and accessibility reasons:
--- title: My First Blog Post layout: "layouts/base.html" tags: - "post" --- ## This is a headline for a blog post This is a paragraph for a blog post.
This creates a singular...