Blog
Learn how to write blog posts in the monorepo.
The blog uses Content Collections, a markdown-based CMS. All content is written and styled using .mdx files. It's markdown combined with React components.
Why choose Content Collections? This is a great alternative to headless CMS platforms such as Contentful or Prismic and is powered by MDX. It’s free, open-source and saves content directly in your repository.
When content changes, you need to redeploy the marketing app because the pages are statically compiled and not dynamically fetched from a database.
Add a new blog post
To create a new blog post, follow these steps:
-
Create a new file Navigate to the
/apps/marketing/content/blogdirectory and create a new.mdxfile. The file name will act as the URL slug for the post. For example:- File name:
hello-world.mdx - URL:
https://your-app.com/blog/hello-world
- File name:
-
Add metadata At the top of the
.mdxfile, include a frontmatter block. This block contains key metadata about your post, written in a YAML-like format enclosed by three dashes (---). Here's an example:
---
title: How to create a blog post
description: A description of your blog posts.
published: 2025-01-20T12:00:00.000Z
category: Innovation
author: elon-tusk
---Things like reading time are automatically calculated.
Add a new author
You don't want to repeat all the author information, it's easier to create the author once and just use reference. In the /apps/marketing/content/authors directory add elon-tusk.mdx:
---
ref: elon-tusk
name: Elon Tusk
avatar: https://randomuser.me/api/portraits/men/81.jpg
---Then you can reference the author with author: elon-tusk in your blog frontmatter blocks.