Frontmatter is the metadata for the post, it contains title, slug, date, category, tags, etc.
Here frontmatter is following YAML format so the frontmatter options will be enclosed within triple dashes (---).
Frontmatter must be kept at the top of index.md
file.
Here is an example of the frontmatter:
---
title: Excellent Title for Your Post
description: A brief summary or description of your post.
slug: this-is-what-would-be-used-in-url
category: My Awesome Category
tags:
- how to
- example
date: '2024-07-23'
author: vivek
keywords:
- seo optimization
- schema markup
lastmod_date: '2024-07-24'
draft: true
---
There are some more options that can be used. Below is full list of options:
Option | Type | Example | Description |
---|---|---|---|
title | string | 'First Post' | Sets title of the post |
description | string | 'a brief summary of post' | Used in post snipped and SEO. |
slug | string | 'this-is-my-post' | Used in the post url |
category | string | 'Productivity' | Creates the category and add post to it. |
tags | array | list | - feel good - beginner | Associate the post with given tags. Also used in SEO |
date | string | '2024-07-25' | Sets the created date of the post. |
lastmod_date | string | '2024-07-26' | Sets the last modified/updated date for post. Used in SEO. |
author | string | list | 'vivek' | Shows author name in the post. |
keywords | list | array | - how to write - journaling | Used for SEO |
image | string | 'post-dir/image-name.png' | For cover and opengraph image of post |
draft | boolean | true | false | Sets whether the post is draft or not |
aliases | list | array | - alternate-slug | Defines alternate slug, this will be redirected to the original slug |
robotsNoIndex | boolean | true | If set to true then post will not be indexed by search engines (if not already done) |
showToc | boolean | false | If set to false then table of contents will not be show |
unlisted | boolean | true | If set to true then post will not be directly accessible, even by search engines. Can be accessed only via direct link. |
ghost | boolean | true | Blog post not visible anywhere on the site however indexable by search engines and included in sitemap.xml |
redirectToUrl | string | https://vivekshuk.la | Will redirect user to given url when post is opened |