A blog with Notion as content management system. Imports content from notion and publishes it.
⚠️ Versions of Python older than 3.6 may not work
- Create a virtual environment using
venv
. For systems usingapt
:
sudo apt install python3-venv
python3 -m venv .env
- Source the virtual environment and install
dependencies from
requirements.txt
source .env/bin/activate
pip3 install -r requirements.txt
- You need to create a
.secrets
file with the following contents:
#!/bin/bash
export TOKEN_V2="<YOUR TOKEN_V2>"
export SPACE_ID="<WORKSPACE ID>"
-
Token can be obtained from cookies as
token_v2
after logging in Notion. -
To obtain workspace id, login to Notion, use developer tools in browser. Go to Networks tab and press
Ctrl+R
to reload the page. Look forgetSpaces
object. Click on the object and go to Preview tab. Expand and look for id inspaces
value corresponding to the required workspace.
Give execute permissions to this file:
chmod +700 .secrets
- Remove lines 5-7 in
.gitignore
After creating the .secrets
file, run the program as follows:
bash run.sh
To customize the homepage or collection page, edit the corresponding html
templates in templates
directory.
- Pages/Collections are only downloaded if they have been changed. Deleted objects are removed.
- Currently it only supports pages and collections of pages. I do not know how to export pages inside pages without sending an email to the members.
- Remove redundant zips and check availability straight from HTML pages
Feel free to open issues/pull requests. Format code with black
formatter before
submitting please.