Back to Home

Introducing hugo-notion. Write in Notion. Publish with Hugo.

I’ve ported hugo-notion from Ruby to Go lang and the installation instructions have changed since. Please visit hugo-notion’s README github.com/nisanthchunduru/hugo-notion for the latest installation instructions. Thanks!

I recently revived this Hugo blog and as I resumed writing blog posts, I

  1. Increasingly desired a better writing experience than writing Markdown files in VSCode (or a different Markdown editor)
  2. Desired to be able to start a blog post on my office laptop but finish it on my personal laptop
  3. Desired for an easier way to add screenshots or other images to posts

Since I write often in Notion, I wondered if there was a way to write my Hugo pages in Notion. Unfortunately, Hugo didn’t have any built-in support for Notion. While my googling surfaced command line (CLI) tools that solved this problem, they were time consuming to configure and seemingly unmaintained. Since this was a fairly easy problem to solve, I quickly wrote a Ruby script to sync my Notion pages to Hugo’s content dir.

Today, I’m happy to share that I’m publicly releasing this script as a command line (CLI) tool named hugo_notion https://github.com/nisanthchunduru/hugo-notion

Using hugo-notion requires 3 simple steps. First

  1. Create a Notion integration and generate an API secret https://developers.notion.com/docs/create-a-notion-integration#getting-started
  2. Move your Hugo pages to Notion. I recommend that you move just 1 page first and move other pages once you’re happy with hugo-notion

You can structure your Notion page similarly to my Notion “blog_content” page https://www.notion.so/blog_content-0f1b55769779411a95df1ee9b4b070c9

  1. Install hugo-notion by following the installations instructions in README https://github.com/nisanthchunduru/hugo-notion, change to your hugo site/blog directory and run the huno command

GitHub Actions Deployment Workflow

If you host your blog on GitHub Pages (like many Hugo users do), you even modify your deployment GitHub workflow to sync your Notion pages before deploying your Hugo site/blog to GitHub pages. Here’s an example workflow https://github.com/nisanthchunduru/nisanthchunduru.github.io/blob/9a08a8922114af113052bde6756435199fde63af/.github/workflows/deploy.yml#L46-L49

- name: Install Ruby
  uses: ruby/setup-ruby@v1
  with:
    ruby-version: 3.2.3
- name: Install hugo-nation Gem
  run: gem install hugo-notion --prerelease
- name: Sync blog content from Notion
  run: huno https://www.notion.so/blog_content-0f1b55769779411a95df1ee9b4b070c9

If you host your site/blog with Hugo and are a Notion power user, do give hugo-notion a go. It helps me swiftly write blog posts in Notion and and I hope it’d be useful for you too.

Built with Hugo & Notion. Source code is available at GitHub.