Skip to content

Commit 6fc0090

Browse files
committedMar 21, 2024
Blog: README: Add Guide for Notion and setup env variables
1 parent 8a9f8e5 commit 6fc0090

File tree

2 files changed

+52
-2
lines changed

2 files changed

+52
-2
lines changed
 

‎.env.example

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Notion
2+
NOTION_DATABASE_ID=
3+
NOTION_AUTH_TOKEN=
4+
5+
# Route Handle
6+
API_SECRET=
7+
8+
# URL
9+
SITE_URL=

‎README.md

+43-2
Original file line numberDiff line numberDiff line change
@@ -57,14 +57,55 @@ cd Blog
5757
npm install
5858
```
5959

60-
4. Start the development server:
60+
4. Set up environment variables:
61+
62+
Copy the `.env.example` file to `.env`:
6163

6264
```
63-
npm run dev
65+
cp .env.example .env
6466
```
67+
Then, fill in the environment variables in the `.env` file:
68+
69+
- `NOTION_DATABASE_ID`: Your Notion database ID.
70+
- `NOTION_AUTH_TOKEN`: Your Notion authentication token.
71+
- `API_SECRET`: Choose any secure password for route handler authentication.
72+
- `SITE_URL`: The URL of your website.
73+
74+
#### For Development:
75+
76+
Set `SITE_URL` to `http://localhost:3000` during development.
77+
78+
#### For Production:
79+
80+
Set `SITE_URL` to your production website URL. Ensure it starts with `https://` for secure connections.
81+
82+
5. Setting Up Notion Integration
83+
84+
To integrate your Notion content with this blog website, follow these steps:
85+
86+
I. **Duplicate Notion Blog Template**: Find and duplicate the blog template you want to use in your Notion workspace.
87+
88+
II. **Retrieve Notion Database ID**: Open the duplicated template, and copy the string of characters from the URL after `Blog-`. This string is your Notion database ID.
6589

90+
III. **Publish Notion Page**: Ensure that the Notion page containing your blog content is published by clicking on the "Share" button and selecting "Publish."
91+
92+
IV. **Obtain Notion Authentication Token**: While logged into Notion, right-click anywhere on the page, select "Inspect," navigate to the "Application" tab, and find the `token_v2` cookie. Copy its value.
93+
94+
6. Start the development server:
95+
96+
```
97+
npm run dev
98+
```
6699
Open http://localhost:3000 in your browser to view the website.
67100

101+
7. Build and run for production:
102+
103+
When you're ready to deploy your portfolio:
104+
```
105+
npm run build
106+
npm run start
107+
```
108+
68109
## Contributions
69110

70111
Contributions are what make the open-source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.

0 commit comments

Comments
 (0)