Group by Month - Website update

May 25th, 2022

My current goal is to continue to post some parts, demos, and other miscellaneous documentation of some of the many projects that I have been a part of over the past few years.

Why didn’t I just take notes as I was going?

No clue about that, however, time to rectify some of that. In the future I want to:

  • group posts by month
  • add some robustness to the tag system.
  • I want to add to the posts a notice that it is over a year old, with a link to post on social media that it needs to be updated.
  • I also want to include some pictures on the projects list, basically just redesign the way the cards are formatted.

Here I just want to simply group all of my blog posts by the month and year they were created. This snippet groups all of the posts into an object keyed by the month and year.

const byMonth = posts.reduce((acc: PostsByMonth, page: Post) => {
    if (! return acc;

    const monthYear = format(new Date(, "MMMM yyyy");

    if (acc[monthYear]) {
    } else {
        acc[monthYear] = [page];

    return acc;
}, {});

Then I just render those on the page below:

    Object.keys(byMonth).map((month: string) => {
        return (
            <section key={month}>
                {byMonth[month].map((page: Post) => (
                    <div key={page.fields.slug}>

                        <p key={page.fields.slug}>
                            <i>{format(new Date(, "PPP")}</i> -
                            Tags in this post:{" "}
                            <i>{page.frontmatter.tags.join(", ")}</i>

Check it out on the main page: Blog posts organized by month If you know a better way to accomplish this, let me know in the comments below! I am always trying to learn more effective ways to solve these kinds of problems. The only purpose of building this kind of thing is to learn!

jordan rhea wearing a hoodie
Written by jordan rhea Building tools and connecting systems