/
Embed a Notion page to my website for free
Search
Duplicate
Try Notion

Embed a Notion page to my website for free

Created
September 11, 2023 11:58 AM
Last edited time
October 20, 2023 11:36 PM
Tags
Empty

Results

I successfully embed my public Notion page into my current website using iframe. Now, whenever I add a new page with the post content in my Notion public page, it will be seen on my website without spending any extra money. πŸ€©β€‹
Here is the working version code I use.
choux130/loconotion (my version of loconotion which scrapes the public Notion page and regenerates it into a static website.)
choux130/myblog-yintingchou-notion (my version of Action-NotionSite which includes a Github Action workflow to orchestrate the steps to run loconotion and deploy the webpage to Github Pages.)
Links:
My public Notion page: https://yintingchou.notion.site/yintingchou/103c6108f3a04fcfa6e24d34d83278dc?v=e573fc12d1564c5297295c8c09b88db0
The newly created Github Page which is the same as my public Notion page: https://choux130.github.io/myblog-yintingchou-notion/
My current webpage which embeds the Github Page https://yintingchou.com/notion/ (source code for the page, here)

Motivations

I started my blog in 2017. Since then, I have grown and learned a lot, however, I did not post as much as I wished to share with the public. Recently, I tried to find out the causes, and I think one of the causes is that in my current process, the friction for me to write and publish a blog post is not small enough to make it become a habit. Even though I already have set up a CI/CD pipeline in Netlify to connect to my blog repo in Github so new posts can be auto-deployed easily, to start a new blog post, I still need to first clone the repo to my local machine, create a new markdown file, fight for the image path if I want to insert any images in my post, write and test HTML code if I want to tune the post format and style, and then if everything looks good in my local I push my changes to the remote repo and wait for the website to be updated through the CI/CD pipeline. Serious? All I want is to put together my thoughts, and the things I learn and share with others, do I need to make it like developing a new feature for software? This sounds not right to me, I need to change.
I have been using Notion to capture my personal notes, diary, and daily journal for a while. I like how intuitive it is and how easy it is to embed and connect other services and software. Most importantly, the data can be synced easily between multiple devices. So, now I can write down some quick thoughts on my phone and tablet and then edit it on my laptop or vice versa. Since Notion is so convenient and I am already used to it, could I use Notion to create my blog posts?

Goals

I still want to keep my current website, I am not ready to move everything to Notion which will involve using Notion to create a completely new website and then migrate all the old posts to Notion. It is too much work for me to do it for this round. Also, I still love the current website and I do not want to let it go now.
People can go to my current website to see my new posts which are written through Notion.

Solutions

The simplest way to combine two websites is through iframe, however, it is not working if I directly iframe the notion public page in my current website. This is the error message I got when I tried adding <iframe src="https://yintingchou.notion.site/Embed-Notion-pages-to-my-website-82fe544642a841768adaf4952230c672?pvs=4"></iframe> in my current website page.
Okay! Notion does not allow people to directly iframe its webpage. Now, it is time to research and find a workaround.
Paid methods. I can get an embeddable URL for my Notion page if I am willing to pay for someone to generate that magic URL for me. However, the only thing I am willing to pay for my personal website is the domain subscription, so let’s move on to another ugly but free method.
https://embednotion.com/ ($7.99/mo OR $29.99/mo)
Free methods. Scrape the public Notion page and create a new static website based on the scraping results, deploy the static website hosted as a Github Page, and embed the page from Github instead of Notion.
loconotion (πŸ“„ Python tool to turn Notion.so pages into lightweight, customizable static websites)
There are some issues with installing the latest compatible version of Chrome and chrome driver using the original code. So, I spent some time troubleshooting it and then created a pull request in the end, Pull Request #138.
Action-NotionSite (loconotion + Github Actions + Notion + GitHub Pages + Cloudflare Workers, Create a free website or build a blog.)
This repo includes a walkthrough on how to use Github Action workflow to run loconotion to generate the source code of the Notion page and then deploy it to the GitHub Pages.
However, one thing, I still can not figure out is why the workflow does not constantly succeed given the same code. Based on the pipeline logs, it is something related to the docker volume on the container that occasionally does not successfully sync to the host. So, the workflow can not find the website source code to deploy. The quick and dirty fix for now is just rerunning the workflow.
Thanks a lot to the authors and the contributors of the above two projects. πŸ™β€‹