This is a Go program that generates my website/blog https://blog.kowalczyk.info.
I use Notion to write most of the content.
This custom Go program downloads pages from Notion, caches it in notion_cache
directory, converts to static HTML files and deploys to Netlify.
To extract my content from Notion I reverse engineered their API and wrote a Go library.
I wrote an article about how I got to this point.
Note that this blog is specific to my needs. Most of the content comes from notion.so but there are some .html pages and markdown converted to HTML.
If you want to adopt it for your purposes, here are some things you might want to change:
analyticsCode
inmain.go
notionBlogsStartPage
inarticles.go
. this is a page that has a list of blog articles, which are treated specially (they form the blog part)notionWebsiteStartPage
inarticles.go
this is a page for the root of the website's contentnotionGoCookbookStartPage
inarticles.go
- well, this and all code related to it should be removed. This is a page for the root of my "Go Cookbook" mini-book- make those pages public (but disable search text indexing) (via
Share
button in Notion, at the top right).
Then you can see s\preview.ps1
script to see what the build process is, which currently is:
go build
- run
./blog
or./blog -preview
to also start a local web server for previewing files - Now you can start a local webserver in the
netlify_static
directory (e.g.npx live-server netlify_static
)
HTML files are generated in netlify_static
directory because I deploy to Netlify but since it's mostly a static website, you can deploy it pretty much anywhere.