logo

How I used Notion as a CMS for my blog

profile picture
Joshua Goon4 minute read • 1 years ago

liked this article?
view your liked articles

Unfortunately, modern technology has forced us out of our prehistoric days into an age of Content Management Systems (CMS). What started out as Wordpress, has bloomed into an influx of options — that pretty much all do the same thing.

Writing a blog is pretty straightforward, right? Take your articles, shove it into some HTML and deploy it to be seen by the hundreds of readers, hungry for your insight.

Searching for a CMS

In my process of developing my blog, I began to research all my CMS options, and figure out which one might be the best fit for me. However, I strongly disliked the necessity to add another system to store my things. As a big advocate for keeping things centralized, this thought always lingered in the back of my mind.

Why Notion?

As previously mentioned, one of the primary factors in choosing Notion was the fact that I already used it as my primary note-taking source, and it had a great free API available.

Creating your blog is really only done once, and by reducing any overhead to ship your articles, you can spend more time writing.

What about classic Markdown, or MDX?

While classic markdown is great, and even Notion uses markdown influenced styling, I wanted to be writing my articles in my preferred WYSIWYG environment.

Although MDX, which is MDs even better predecessor that would allow me to add functional code in my articles, I still faced the same issue.

Moreover, my decision to not write in MD/MDX lied in the ease of deployment that came with using a CMS.

Styling the Headless CMS

After I transformed the Notion API response into readable data, I quickly created styling to render the heading, paragraphs and code blocks. The Notion Block API serves an interesting rich_text type, which allowed me to render bold, italicized, and underlined text. One of my favorite components I made was the callout. I was especially fond of the color palette I chose.

Dynamic Site Generation

At the beginning, I would statically build all articles in my blog. This was efficient as it removed the need for creating an api to query the data. The Notion API would be fetched once, and all of the data would populate into html files to be served.

However, this added one extra step that I wasn’t fond of. Every time I updated or created a new article, I would have to manually rebuild all the static pages and redeploy the site.

Not a big issue, right?

No. As an engineer, I took on the role of overcomplicating things.

I wanted to be able to update the articles in Notion, and have the changes reflected without having to manually trigger a rebuild.

Because static site generation was no longer enough for my satisfaction, I had to introduce a server into the picture.

Adding a Server and Caching

Although Notion has a generous free API, because the articles are rarely changing it wouldn’t make sense to call the API every time to fetch the data. To combat this, I used a server side cache to save all the data. By setting a Time To Live (TTL) of one day, I can ensure that the endpoint will serve my updated articles within the next day of being changed.

Should you use Notion?

My recommendation is to not feed into the CMS monstrosity. To reiterate, my entire thought process for using notion was the ability to instantly update and create articles and because all my notes were already being written on there.

Although it was an engaging experience, the truth is it wasn’t worth the time. The easiest and fastest way to get your blog out there is to serve plain ol’ mdx files. Regardless — happy blogging!



liked this article?
view your liked articles

check out some related articles

My top picks for a FAANG rename
2 minute read • 3 months ago

My top picks for a FAANG rename

The commonly used term, “FAANG” has quickly become outdated with the emergence of new tech giants. Here are my top picks for a long awaited and much needed “FAANG” rename.

View Article