Skip to content

Blog

Create a new post

Create a new markdown file in your blog directory. For example, docs/blog/my-first-book.md. Here's an example of what it might look like:

md
---
title: "A Study in Scarlet: My first Adventure"
date: 1887-11-01
author: sherlock
category: Books
banner: "/blog/my-first-adventure.jpg"
draft: false
featured: true

excerpt: "This is a short excerpt of the post, which will be displayed on some components."

---

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam nec purus nec nunc

All of the metadata fields are optional, but title and date are recommended.

Full Details:

  • title: title of the post.
  • date: date of the post (in the format YYYY-MM-DD)
  • author: key of the authors, which should match the authors.js file*
  • category: category of the post (used for filtering and visual labeling)
  • banner: a URL or path to an image file for the banner image*
  • draft & featured: These values can be used to filter posts.
    • set draft: true for posts that should not be displayed in lists
    • try to limit featured: true to a few posts to avoid cluttering your featured section

Examples:

Example for author field

If you want to reference "Sherlock Holmes" as the author, you would use author: sherlock, assuming the authors.js file looks like this:

js
const authors = {
    sherlock: { // This is the key used in the post frontmatter
        name: 'Sherlock Holmes',
        avatar: '/authors/sherlock.jpg',
    },
    watson: {
        name: 'Dr. John Watson',
        avatar: '/authors/watson.jpg',
    }
};

export default authors;

Example for banner field

If your image is located in docs/public/blog/my-first-book.jpg, you would use banner: "/blog/my-first-book.jpg" in the frontmatter.