๐ This is my personal website and blog, built using Next.js, TypeScript, Tailwind CSS, and Notion. The blog posts are managed in Notion, and the website pulls the content from the Notion API at build time.
- Landing page with customizable background image and hero text
- Blog page with pagination and search functionality
- Separate pages for each blog post
- Dynamically generated RSS feed
- Automatic sitemap generation
- Notion as a CMS for blog content management
- Integration with Giscus for comment section
To get started with this project, follow these steps:
To get started with this project, you can clone the repository and install the dependencies:
git clone https://github.com/howznguyen/howz.dev.git
cd howz.dev
npm install
Copy the .env file to .env.example:
cp .env .env.example
You can duplicate the Notion page for database template here.
Once you have your own duplicate page, you can get the NOTION_API_KEY
and database IDs needed to run the project. To get your NOTION_API_KEY
, follow these steps:
Warning: Calling notion api in browser will leak your token to everyone who visit your blog website. And then they can write/delete your notion database. Be sure that your token is only granted with Read access.
- Go to your Notion integrations page.
- Click on the "Create new integration" button.
- Give your integration a name and click the "Submit" button.
- You'll now see your integration listed on the page. Click on the integration's name.
- You should now see your integration details page. You can find your
NOTION_API_KEY
under the "Internal Integration Tokens" section.
To add your app into page, folow these steps:
- Open your duplicated database in Notion.
- Click on the three dots in the top-right corner of the page.
- Then you selecting "Add connections" and choosing your app name.
To get the database IDs, follow these steps:
- Open your duplicated database in Notion.
- Click on the three dots in the top-right corner of the page.
- Click on "Copy link URL."
- You should see the database ID in the URL. It's the long string of characters between the last two forward slashes.
Update the .env
file with your NOTION_API_KEY
and the database IDs for your settings, navigation, footer, and posts databases. Use the .env.example
file as a guide.
You can customize the language content and categories in folder src/lang
In this folder, you can see 2 files en.json
and vi.json
. You can add more language file with the same format.
If you want to customize the categories in home page, you can edit values in key categories
in en.ts
and vi.ts
file.
To enable commenting functionality using Giscus, you need to set up a repository and obtain a repository ID. You can find more information on the Giscus website.
- Sign up for a Giscus account and create a new site.
- Choose the "GitHub Discussions" option as your comment platform.
- Configure your site by providing your GitHub repository information and choosing a category name.
- In your
.env
file, add the following variables with the values for your Giscus site:
GISCUS_REPO=username/repository
GISCUS_REPO_ID=repository-id
GISCUS_CATEGORY=category-name
GISCUS_CATEGORY_ID=category-id
To enable Google Analytics, you need to set up a Google Analytics account and obtain a tracking ID. You can find more information on the Google Analytics website.
- Sign up for a Google Analytics account and create a new property.
- Choose the "Web" option as your platform.
- Configure your property by providing your website information.
- In your
.env
file, add the following variable with the value for your Google Analytics tracking ID:
NEXT_PUBLIC_GA_TRACKING_ID=tracking-id
To run the project, you can use the following command:
npm run start:all
The project will be available at http://localhost:3000.