jekyll-notion
2022-03-19 3 min
As I promised in a previous post, I’m proudly announcing the release of the jekyll-notion gem. Well, to be fair, the gem was released more than two months ago. In fact, the current version is 2.0.0. I’ve been reworking the library and until now I did not have much time to redact this article.
Anyway, here we are. So, let me tell you a little bit about the gem.
Jekyll-notion allows you to use notion as a CMS. In other words, you can now create and edit your documents easily and anywhere with notion and let jekyll consume them automatically.
Yes, there are other solutions like Cloudcannon for editing content in jekyll, but they are not intended for particular uses. Come on, I don’t know about you, but I don’t plan to pay a $45/month subscription to write one or two articles a month. Anyway, Cloudcannon is not only about editing, but publishing and hosting your website(s).
So, I thought there was a gap here for an open source project to connect an interesting tool like notion with jekyll.
But before getting your hands dirty, you had to do some preliminary thinking, such as understanding how the Notions API works.
Basically, there are two types of objects: pages and databases.
A page, as its name suggests, is a document containing rich text and properties of different types.
Pages can be created independently or contained in a database. A database allows pages to be organized according to their properties.
On the other hand, Jekyll has pages and collections. Both entities correlate with notion pages and databases.
So there is a clear analogy here.
A notion page can be converted to markdown, which is the default format supported by Jekyll. Page properties can be stored as front matter in a Jekyll page. For this purpose the notion_to_md gem can be used. And, notion databases are like Jekyll collections. Therefore, each page of a database can be converted into a Jekyll document, which is almost the same as a Jekyll page.
With all these notions at hand, never better said, the only thing to do was to automate this process. And that’s where jekyll-notion fills the gap.
This is the first post in a series of articles I would like to share for the use of jekyll-notion.
Stay tuned. In future articles, I will show you how to map notion pages to jekyll.
See you soon.