DEV Community

loading...

My Notion Powered Blog

samborick profile image Sam Borick Originally published at borick.net on ・2 min read

Hello! I’ve just finished making some really neat changes to the way my blog works behind the scenes. I want to make sure everything works, so here’s a quick article!

Notion

I was inspired by this:

Powering a blog with Notion and Netlify

This person took the time to write a golang library that can pull data from notion, and there’s no way I could have gotten this done without it!

I used this library to dump all the pages within a certian notion database to markdown files.

From there I do some massaging on the files. Things like removing unnessessary markdown elements like the title and modifying notion links to be non-notion links. That way I can link to other articles with just the + button in notion: projects. Neat!

Hugo

To make this as easy as possible, I wanted to integrate with my existing website. Luckily Hugo is all powered by markdown, so I can insert my massaged markdown directly into my hugo site.

Auto updating

The goal is for me to be able to write things in notion, and have it just appear on the internet. I decided to set up a simple cron script that would run every hour.

Of course cron is somewhat difficult to get working, but I found these resources super useful:

I put a cronjob in /etc/cron.{hourly,daily,weekly,monthly} and it does not run and how can I troubleshoot it? - nixCraft

how can I make cron run a job right now, for testing/debugging? without changing the schedule!

To summarize:

  • Cron scripts have to omit any file extension, no .sh can be present
  • they also need the shebang in the script
  • you can run run-parts /etc/cron.hourly to kick off a cron script to see if it works

Sharing

Through the magic of RSS I can share things automatically also! Dev.to already supports syndicating articles from an RSS feed, so I can automatically share there for no work. To share links to twitter, I set up a simple RSS to Buffer Zap on Zapier, so a tweet can go out at an appropriate time.

Conclusion

Hopefully this will make it easier for me to write more! At the minimum it was a fun way to spend part of a weekend.

Discussion

pic
Editor guide