2.2 KiB
Environment Variables
The following environment variables are listed in the project's .env.example file:
| Variable Name | Description |
|---|---|
GITHUB_TOKEN |
Enter your Personal access token |
GISCUS_REPO_OWNER |
Your GitHub username, for example ClovertaTheTrilobita |
GISCUS_REPO_NAME |
Your code repository name, for example SanYeCao-blog |
GISCUS_CATEGORY_ID |
The category ID of GISCUS, see the explanation below |
GISCUS_DATA_REPO_ID |
The repository ID of GISCUS, see the explanation below |
1. GITHUB_TOKEN
It can greatly increase your GitHub API rate limit. Open this link: Personal access tokens
Choose Generate new token.
Then copy the generated token into the corresponding place in your .env file.
2. GISCUS
This blog uses a comment section based on the GISCUS API, which can map part of the GitHub repository's Discussions section onto your webpage as a comment area.
① Enable Discussions in your repository
Go to Settings > General > Features in your repository and check Discussions to enable it.
Then go to the Discussions page, click the pencil icon next to Categories on the left side of the page, and then click New category to create a new category named Comments.
② Install the Giscus GitHub App
Open this link: GitHub App - giscus
Install it into the blog code repository you forked.
Then go to: giscus.app
In the Repository field, enter your repository address, and in Page ↔️ Discussions Mapping, choose Discussion title contains a specific term.
In Discussion Category, select the Comments category you just created.
Finally, in the generated code below, find data-category-id and data-repo-id, and fill them into the environment variables.