From ea31548aff397f41c5ab7bc0b12fd68e93cdacdf Mon Sep 17 00:00:00 2001 From: shlu Date: Mon, 23 Dec 2024 16:00:52 +0800 Subject: [PATCH] =?UTF-8?q?feat(jekyll:comments):=20=E5=9B=BD=E9=99=85?= =?UTF-8?q?=E5=8C=96=E6=94=AF=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- _config.yml | 2 +- _layouts/default.html | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/_config.yml b/_config.yml index 882d3346..b0699ab1 100644 --- a/_config.yml +++ b/_config.yml @@ -33,7 +33,7 @@ commonmark: #markdown: redcarpet #redcarpet: # extensions: ["autolink", "no_intra_emphasis", "tables", "strikethrough"] -lang: zh-CN +# lang: zh-CN permalink: pretty readme_index: enabled: true diff --git a/_layouts/default.html b/_layouts/default.html index 8376b4db..66153acf 100644 --- a/_layouts/default.html +++ b/_layouts/default.html @@ -44,6 +44,12 @@

{{ site.title }}

data-lang="zh-CN" crossorigin="anonymous" async> + function isEmpty(str) { + return (!str || str.trim() === ""); + } + if (isEmpty(document.documentElement.lang) || document.documentElement.lang.startsWith("en")) { + document.currentScript.setAttribute("data-lang", ""); + } (function(){function h(a){return'[giscus] An error occurred. Error message: "'.concat(a,'".')}function l(a,g){void 0===g&&(g=!1);g=g?"meta[property='og:".concat(a,"'],"):"";return(a=document.querySelector(g+"meta[name='".concat(a,"']")))?a.content:""}function p(){delete c.session;var a="".concat(k,"/widget?").concat(new URLSearchParams(c));e.src=a}var m=document.currentScript,k="https://giscus.app",b=new URL(location.href),d=b.searchParams.get("giscus")||"",n=localStorage.getItem("giscus-session"); b.searchParams.delete("giscus");b.hash="";var f=b.toString();if(d)localStorage.setItem("giscus-session",JSON.stringify(d)),history.replaceState(void 0,document.title,f);else if(n)try{d=JSON.parse(n)}catch(a){localStorage.removeItem("giscus-session"),console.warn("".concat(h(null===a||void 0===a?void 0:a.message)," Session has been cleared."))}b=m.dataset;var c={};c.origin=f;c.session=d;c.theme=b.theme;c.reactionsEnabled=b.reactionsEnabled||"1";c.emitMetadata=b.emitMetadata||"0";c.inputPosition=b.inputPosition|| "bottom";c.repo=b.repo;c.repoId=b.repoId;c.category=b.category||"";c.categoryId=b.categoryId;c.strict=b.strict||"0";c.description="";c.backLink=`[web link](${l("giscus:backlink")||f})`;switch(b.mapping){case "url":c.term=f;break;case "title":c.term=document.title;break;case "og:title":c.term=l("title",!0);break;case "specific":c.term=b.term;break;case "number":c.number=b.term;break;default:c.term=2>location.pathname.length?"index":decodeURIComponent(location.pathname.substring(1).replace(/\.\w+$/,""))}var q=(d=document.querySelector(".giscus"))&&