Blog
Learn how to manage your blog content.
TurboStarter comes with a pre-configured blog implementation that allows you to manage your blog content.
Creating a new blog post
To create a new blog post, you need to create a new .mdx
file in the packages/cms/src/collections/blog/content
directory.
The file will start with a frontmatter block, which is a yaml-like block that contains metadata about the post. The frontmatter block should be surrounded by three dashes (---
).
Let's break down the frontmatter fields:
title
: The title of the blog post (it will be also used to generate a slug for the blog post)description
: The description of the blog postpublishedAt
: The date when the blog post was publishedtags
: The tags of the blog postthumbnail
: The thumbnail of the blog poststatus
: The status of the blog post (could bepublished
ordraft
)
After the frontmatter block, you can add the content of the blog post:
You can consume the content the same as it's described in Content Collections.
BONUS: Using custom components
As you're using MDX, you can use any React component in your blog posts. Just define it as a normal React component and pass it to <MdxContent />
in components
prop:
Then, you would be able to use it in your document content and it will rendered on the page as a result:
TurboStarter ships with a set of default components that you can use in your blog posts, e.g. <Callout />
, <Card />
etc. Use them or define your own to make your blog posts more engaging.
Last updated on