From 30e09c6aab762b2ae32d369a4acd4dcdf2ef8e22 Mon Sep 17 00:00:00 2001 From: Meekdai Date: Fri, 19 Jul 2024 15:17:21 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0head=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=EF=BC=8C=E7=94=A8=E4=BA=8E=E9=85=8D=E7=BD=AE=E8=87=AA=E5=AE=9A?= =?UTF-8?q?=E4=B9=89=E6=96=87=E7=AB=A0=E9=A1=B5head=E5=86=85=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Gmeek.py | 9 ++++++++- templates/post.html | 1 + 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/Gmeek.py b/Gmeek.py index 27f4493..8fb807e 100644 --- a/Gmeek.py +++ b/Gmeek.py @@ -88,7 +88,7 @@ def cleanFile(self): def defaultConfig(self): - dconfig={"singlePage":[],"startSite":"","filingNum":"","onePageListNum":15,"commentLabelColor":"#006b75","yearColorList":["#bc4c00", "#0969da", "#1f883d", "#A333D0"],"i18n":"CN","themeMode":"manual","dayTheme":"light","nightTheme":"dark","urlMode":"pinyin","script":"","style":"","indexScript":"","indexStyle":"","bottomText":"","showPostSource":1,"iconList":{},"UTC":+8,"rssSplit":"sentence","exlink":{},"needComment":1,"allHead":""} + dconfig={"singlePage":[],"startSite":"","filingNum":"","onePageListNum":15,"commentLabelColor":"#006b75","yearColorList":["#bc4c00", "#0969da", "#1f883d", "#A333D0"],"i18n":"CN","themeMode":"manual","dayTheme":"light","nightTheme":"dark","urlMode":"pinyin","script":"","style":"","head":"","indexScript":"","indexStyle":"","bottomText":"","showPostSource":1,"iconList":{},"UTC":+8,"rssSplit":"sentence","exlink":{},"needComment":1,"allHead":""} config=json.loads(open('config.json', 'r', encoding='utf-8').read()) self.blogBase={**dconfig,**config}.copy() self.blogBase["postListJson"]=json.loads('{}') @@ -188,6 +188,7 @@ def createPostHtml(self,issue): postBase["commentNum"]=issue["commentNum"] postBase["style"]=issue["style"] postBase["script"]=issue["script"] + postBase["head"]=issue["head"] postBase["top"]=issue["top"] postBase["postSourceUrl"]=issue["postSourceUrl"] postBase["repoName"]=options.repo_name @@ -371,6 +372,11 @@ def addOnePostJson(self,issue): else: self.blogBase[listJsonName][postNum]["script"]=self.blogBase["script"] + if "head" in postConfig: + self.blogBase[listJsonName][postNum]["head"]=self.blogBase["head"]+str(postConfig["head"]) + else: + self.blogBase[listJsonName][postNum]["head"]=self.blogBase["head"] + if "ogImage" in postConfig: self.blogBase[listJsonName][postNum]["ogImage"]=postConfig["ogImage"] else: @@ -478,6 +484,7 @@ def createFileName(self,issue,useLabel=False): del blog.blogBase["postListJson"][i]["createdAt"] del blog.blogBase["postListJson"][i]["script"] del blog.blogBase["postListJson"][i]["style"] + del blog.blogBase["postListJson"][i]["head"] del blog.blogBase["postListJson"][i]["top"] del blog.blogBase["postListJson"][i]["ogImage"] diff --git a/templates/post.html b/templates/post.html index e60270e..67db0ac 100644 --- a/templates/post.html +++ b/templates/post.html @@ -9,6 +9,7 @@ {{ blogBase['postTitle'] }} {% if blogBase['highlight']==1 %}{% endif %} +{{ blogBase['head'] }} {% endblock %} {% block style %}