DEV Community

Discussion on: Creating a Markdown Blog with Next.js

Collapse
 
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!

Collapse
 
kendallstrautman profile image
Kendall Strautman • Edited

Yeah I think both methods would work! Agree that the first would be simplest. I've implemented the latter on the tinacms.org 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.