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!
I was inspired by this:
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!
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.
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:
- Cron scripts have to omit any file extension, no
.shcan be present
- they also need the shebang in the script
- you can run
run-parts /etc/cron.hourlyto kick off a cron script to see if it works
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.
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.