vaibhavviswanathan / blog

Static site generator from Notion for my website

Home Page:http://vaibhavviswanathan.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Build Status

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.

Build and run

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 in main.go
  • notionBlogsStartPage in articles.go. this is a page that has a list of blog articles, which are treated specially (they form the blog part)
  • notionWebsiteStartPage in articles.go this is a page for the root of the website's content
  • notionGoCookbookStartPage in articles.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:

  1. go build
  2. run ./blog or ./blog -preview to also start a local web server for previewing files
  3. 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.

About

Static site generator from Notion for my website

http://vaibhavviswanathan.com


Languages

Language:HTML 65.4%Language:Python 9.4%Language:JavaScript 8.5%Language:Go 6.4%Language:CSS 6.1%Language:C++ 3.0%Language:C 0.8%Language:Makefile 0.3%Language:Shell 0.1%Language:Batchfile 0.0%Language:Ruby 0.0%