From 978ae2f363f5bd9bc619b1da9d101d487c51c94f Mon Sep 17 00:00:00 2001 From: ClovertaTheTrilobita Date: Sat, 4 Apr 2026 20:57:22 +0300 Subject: [PATCH] update remark link to env --- .env.example | 8 +-- src/components/remark42-counter.svelte | 50 +++++++++++-------- src/components/remark42-embed.svelte | 4 +- .../remark42-latest-comments.svelte | 5 +- 4 files changed, 35 insertions(+), 32 deletions(-) diff --git a/.env.example b/.env.example index 15d7730..f8ea950 100644 --- a/.env.example +++ b/.env.example @@ -1,6 +1,2 @@ -GITHUB_TOKEN= -GISCUS_REPO_OWNER= -GISCUS_REPO_NAME= -GISCUS_CATEGORY_ID= -GISCUS_DATA_REPO_ID= -PUBLIC_COMMENT_SERVER_URL= \ No newline at end of file +PUBLIC_REMARK42_HOST=https://comments.cloverta.top +PUBLIC_REMARK42_SITE_ID=cloverta-blog \ No newline at end of file diff --git a/src/components/remark42-counter.svelte b/src/components/remark42-counter.svelte index 4a91f01..55f69e9 100644 --- a/src/components/remark42-counter.svelte +++ b/src/components/remark42-counter.svelte @@ -1,30 +1,38 @@ + import { onMount } from "svelte"; - - - + + script.defer = true; + script.src = `${remark_config.host}/web/${name}${ext}`; + document.head.appendChild(script); + } + }); + diff --git a/src/components/remark42-embed.svelte b/src/components/remark42-embed.svelte index aef0982..e833a48 100644 --- a/src/components/remark42-embed.svelte +++ b/src/components/remark42-embed.svelte @@ -23,8 +23,8 @@ const scriptId = "remark42-script"; window.remark_config = { - host: "https://comments.cloverta.top", - site_id: "cloverta-blog", + host: import.meta.env.PUBLIC_REMARK42_HOST, + site_id: import.meta.env.PUBLIC_REMARK42_SITE_ID, components: ["embed"], show_rss_subscription: false, theme: getTheme(), diff --git a/src/components/remark42-latest-comments.svelte b/src/components/remark42-latest-comments.svelte index 83060f8..87b8e35 100644 --- a/src/components/remark42-latest-comments.svelte +++ b/src/components/remark42-latest-comments.svelte @@ -13,7 +13,6 @@ const href = link.getAttribute("href"); if (!href) return; - // 只改 /posts/... 这种相对路径 if (href.startsWith("/posts/")) { link.setAttribute("href", `/${lang}${href}`); } @@ -22,8 +21,8 @@ onMount(() => { window.remark_config = { - host: "https://comments.cloverta.top", - site_id: "cloverta-blog", + host: import.meta.env.PUBLIC_REMARK42_HOST, + site_id: import.meta.env.PUBLIC_REMARK42_SITE_ID, components: ["last-comments"], theme: localStorage.getItem("color-theme") ?? "light", max_last_comments: 10,