move giscus token to .env

This commit is contained in:
ClovertaTheTrilobita 2026-03-25 12:45:43 +02:00
parent 3ac19d8593
commit 77037e6459
2 changed files with 14 additions and 3 deletions

5
.env.example Normal file
View file

@ -0,0 +1,5 @@
GITHUB_TOKEN=
GISCUS_REPO_OWNER=
GISCUS_REPO_NAME=
GISCUS_CATEGORY_ID=
GISCUS_DATA_REPO_ID=

View file

@ -1,5 +1,11 @@
--- ---
const { term } = Astro.props; const { term } = Astro.props;
const repoOwner = import.meta.env.GISCUS_REPO_OWNER;
const repoName = import.meta.env.GISCUS_REPO_NAME;
const categoryId = import.meta.env.GISCUS_CATEGORY_ID;
const dataRepoId = import.meta.env.GISCUS_DATA_REPO_ID;
const repo = `${repoOwner}/${repoName}`;
--- ---
<section class="comments"> <section class="comments">
@ -7,10 +13,10 @@ const { term } = Astro.props;
<script <script
src="https://giscus.app/client.js" src="https://giscus.app/client.js"
data-repo="ClovertaTheTrilobita/SanYeCao-blog" data-repo={repo}
data-repo-id="R_kgDORvuVpA" data-repo-id={dataRepoId}
data-category="Comments" data-category="Comments"
data-category-id="DIC_kwDORvuVpM4C5MDE" data-category-id={categoryId}
data-mapping="specific" data-mapping="specific"
data-term={term} data-term={term}
data-strict="1" data-strict="1"