DEV Community


Discussion on: Creating a Markdown Blog with Next.js

stschindler profile image
Stefan Schindler • Edited

How do you handle post ordering? Easiest I can think of is just prefixing every post filename with a date, but I don't really like adding meta data to the filename.

Another simple idea is adding the publication date as front matter and then sorting all posts when reading them. Might be a little slow though.

Any ideas?

Nice article!

kendallstrautman profile image
Kendall Strautman Author • Edited

Yeah I think both methods would work! Agree that the first would be simplest. I've implemented the latter on the site for the blog index if you wanna check it out. You can also see the pagination implementation there so you only render a certain number of posts per page.