.mdx files in the src/content/blog/ directory, making it easy to manage your posts using Markdown.
- Content Location:
sabo/src/content/blog/ - Public Assets:
sabo/public/blog/(author pictures and post thumbnails) - List Page:
sabo/src/app/blog/page.tsx - Entry Page:
sabo/src/app/blog/[slug]/page.tsx - Helper:
sabo/src/lib/posts.ts
Adding a New Blog Post
Creating a new blog post is as simple as adding a new MDX file.1
Create a New File
Create a new
.mdx file inside the src/content/blog/ directory. The filename will be used as the URL slug, so it’s best to use kebab-case (e.g., my-first-post.mdx).2
Add Frontmatter
At the very top of your new file, add a “frontmatter” block. This is a YAML block surrounded by
--- that contains all the metadata for your post.3
Write Your Content
Below the frontmatter, write your blog post content using Markdown and MDX.You can also import and use other custom React components.
Basic Formatting
You can use all standard Markdown features like bold text, italics, and lists.Adding Links
- External Links: Use standard Markdown syntax:
[Link Text](https://example.com) - Internal Links: For linking to other pages within your site (e.g., the pricing page), it’s recommended to import and use Next.js’s
<Link>component for optimal performance.
4
Add Images
- Author Pictures: Place new author images in
public/blog/authors/. - Post Thumbnails: Place new thumbnail images in
public/blog/thumbnails/.
/blog/authors/name.png).Understanding the Frontmatter
All fields in the frontmatter are important for how the post is displayed.The main title of the blog post.
A short summary used for SEO and on the blog listing page.
The publication date in
YYYY-MM-DD format. This is used to sort posts.The name of the post’s author.
The path to the author’s image, relative to the
public folder.The path to the post’s thumbnail image, relative to the
public folder.A list of tags associated with the post. These are displayed on the post page and can be used for filtering.
How It Works
Blog posts are read fromsrc/content/blog, parsed for frontmatter, and sorted by date (newest first).
sabo/src/lib/posts.ts
sabo/src/lib/posts.ts
Slugs are derived from filenames (e.g.,
my-first-post.mdx → /blog/my-first-post).