通过文章页自定义ogImage字段来配置分享预览图片
默认为avatarUrl
This commit is contained in:
parent
d2aff31483
commit
98b8114b32
8
Gmeek.py
8
Gmeek.py
@ -138,9 +138,7 @@ class GMEEK():
|
||||
postBase["postTitle"]=issue["postTitle"]
|
||||
postBase["postUrl"]=self.blogBase["homeUrl"]+"/"+issue["postUrl"]
|
||||
postBase["description"]=issue["description"]
|
||||
postBase["createdDate"]=issue["createdDate"]
|
||||
postBase["author"]=self.blogBase["title"]
|
||||
postBase["image"]="https://github.com/Meekdai/meekdai.github.io/assets/11755104/b25f48ac-ca50-477c-83ca-c3bdb0b388ab"
|
||||
postBase["ogImage"]=issue["ogImage"]
|
||||
postBase["postBody"]=post_body
|
||||
postBase["commentNum"]=issue["commentNum"]
|
||||
postBase["style"]=issue["style"]
|
||||
@ -327,6 +325,10 @@ class GMEEK():
|
||||
else:
|
||||
self.blogBase[listJsonName][postNum]["script"]=self.blogBase["script"]
|
||||
|
||||
if "ogImage" in postConfig:
|
||||
self.blogBase[listJsonName][postNum]["ogImage"]=postConfig["ogImage"]
|
||||
else:
|
||||
self.blogBase[listJsonName][postNum]["ogImage"]=self.blogBase["avatarUrl"]
|
||||
|
||||
thisTime=datetime.datetime.fromtimestamp(self.blogBase[listJsonName][postNum]["createdAt"])
|
||||
thisTime=thisTime.astimezone(self.TZ)
|
||||
|
||||
@ -6,9 +6,7 @@
|
||||
<meta property="og:description" content="{{ blogBase['description'] }}">
|
||||
<meta property="og:type" content="article">
|
||||
<meta property="og:url" content="{{ blogBase['postUrl'] }}">
|
||||
<meta property="og:image" content="{{ blogBase['image'] }}" />
|
||||
<meta property="article:published_time" content="{{ blogBase['createdDate'] }}">
|
||||
<meta property="article:author" content="{{ blogBase['author'] }}">
|
||||
<meta property="og:image" content="{{ blogBase['ogImage'] }}">
|
||||
<title>{{ blogBase['postTitle'] }}</title>
|
||||
{% if blogBase['highlight']==1 %}<link href="//unpkg.com/@wooorm/starry-night@2.1.1/style/both.css" rel="stylesheet" />{% endif %}
|
||||
{% endblock %}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user