mirror of
https://github.com/ClovertaTheTrilobita/SanYeCao-blog.git
synced 2026-07-03 15:41:26 +00:00
update remark link to env
This commit is contained in:
parent
3f23b930d3
commit
978ae2f363
4 changed files with 35 additions and 32 deletions
|
|
@ -1,6 +1,2 @@
|
|||
GITHUB_TOKEN=
|
||||
GISCUS_REPO_OWNER=
|
||||
GISCUS_REPO_NAME=
|
||||
GISCUS_CATEGORY_ID=
|
||||
GISCUS_DATA_REPO_ID=
|
||||
PUBLIC_COMMENT_SERVER_URL=
|
||||
PUBLIC_REMARK42_HOST=https://comments.cloverta.top
|
||||
PUBLIC_REMARK42_SITE_ID=cloverta-blog
|
||||
|
|
@ -1,30 +1,38 @@
|
|||
<script>
|
||||
export let url;
|
||||
</script>
|
||||
import { onMount } from "svelte";
|
||||
|
||||
<svelte:head>
|
||||
<script async lang="javascript">
|
||||
var remark_config = {
|
||||
host: "https://comments.cloverta.top",
|
||||
site_id: "cloverta-blog",
|
||||
export let url;
|
||||
|
||||
const host = import.meta.env.PUBLIC_REMARK42_HOST;
|
||||
const siteId = import.meta.env.PUBLIC_REMARK42_SITE_ID;
|
||||
|
||||
onMount(() => {
|
||||
const remark_config = {
|
||||
host,
|
||||
site_id: siteId,
|
||||
components: ["counter"],
|
||||
show_rss_subscription: false,
|
||||
theme: localStorage.getItem("color-theme") ?? "light",
|
||||
};
|
||||
!(function (e, n) {
|
||||
for (var o = 0; o < e.length; o++) {
|
||||
var r = n.createElement("script"),
|
||||
c = ".js",
|
||||
d = n.head || n.body;
|
||||
"noModule" in r
|
||||
? ((r.type = "module"), (c = ".mjs"))
|
||||
: (r.async = !0),
|
||||
(r.defer = !0),
|
||||
(r.src = remark_config.host + "/web/" + e[o] + c),
|
||||
d.appendChild(r);
|
||||
|
||||
window.remark_config = remark_config;
|
||||
|
||||
for (const name of remark_config.components || ["embed"]) {
|
||||
const script = document.createElement("script");
|
||||
let ext = ".js";
|
||||
|
||||
if ("noModule" in script) {
|
||||
script.type = "module";
|
||||
ext = ".mjs";
|
||||
} else {
|
||||
script.async = true;
|
||||
}
|
||||
})(remark_config.components || ["embed"], document);
|
||||
</script>
|
||||
</svelte:head>
|
||||
|
||||
script.defer = true;
|
||||
script.src = `${remark_config.host}/web/${name}${ext}`;
|
||||
document.head.appendChild(script);
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<span class="remark42__counter" data-url={url}></span>
|
||||
|
|
|
|||
|
|
@ -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(),
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Reference in a new issue