left branchright branch
left branchleft branch

← Return to writings

How to Build a Next.js Blog

7 mars 2026

Today is a good day!

I woke up in a great mood. I made myself sandwitches with ham/egg and mayonnaise on a really tasty bread. As I'm writting this, I'm working on the coding of this markdown page on which you are reading at this moment. I'm perfectionistic guy so I lost about 1h choosing the colors of the code segment lmao

So this is how to do it:


import { matter } from 'gray-matter'

const { data, content } = matter(fileContent);

return {
    title: data.title || entryName,
    date: new Date(data.date),
    content,
};

with your markdown file that needs to start like this:

---
title: "How to code a markdown metadata reader"
date: "2026-03-07"
description: "A guide to using Markdown in Next.js"
tags: ["react", "nextjs", 'markdown']
---