Skip to content

Commit 5937cb2

Browse files
committed
更新 post.html
1 parent 1a8aeeb commit 5937cb2

1 file changed

Lines changed: 43 additions & 54 deletions

File tree

templates/post.html

Lines changed: 43 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -1,114 +1,103 @@
11
{% extends 'base.html' %}
2+
<!-- 继承基础模板,用于统一页面结构 -->
23

34
{% block head %}
5+
<!-- 定义页面头部区块,包含元数据和页面特定的样式链接 -->
46
<meta name="description" content="{{ blogBase['description'] }}">
7+
<!-- 页面描述 -->
58
<meta property="og:title" content="{{ blogBase['postTitle'] }}">
9+
<!-- 社交媒体分享标题 -->
610
<meta property="og:description" content="{{ blogBase['description'] }}">
11+
<!-- 社交媒体分享描述 -->
712
<meta property="og:type" content="article">
13+
<!-- 社交媒体分享类型 -->
814
<meta property="og:url" content="{{ blogBase['postUrl'] }}">
15+
<!-- 社交媒体分享URL -->
916
<meta property="og:image" content="{{ blogBase['ogImage'] }}">
17+
<!-- 社交媒体分享图像 -->
1018
<title>{{ blogBase['postTitle'] }}</title>
19+
<!-- 页面标题 -->
1120
{% if blogBase['highlight']==1 %}<link href="//unpkg.com/@wooorm/starry-night@2.1.1/style/both.css" rel="stylesheet" />{% endif %}
21+
<!-- 根据配置决定是否引入代码高亮样式 -->
1222
{% endblock %}
1323

1424
{% block style %}
25+
<!-- 定义页面特定的样式区块 -->
1526
<style>
1627
.postTitle{margin: auto 0;font-size:40px;font-weight:bold;}
28+
<!-- 文章标题样式 -->
1729
.title-right{display:flex;margin:auto 0 0 auto;}
30+
<!-- 标题右侧操作按钮布局 -->
1831
.title-right .circle{padding: 14px 16px;margin-right:8px;}
1932
#postBody{border-bottom: 1px solid var(--color-border-default);padding-bottom:36px;}
33+
<!-- 文章主体内容样式 -->
2034
#postBody hr{height:2px;}
21-
#cmButton{height:48px;margin-top:48px;}
22-
#comments{margin-top:64px;}
23-
.g-emoji{font-size:24px;}
35+
<!-- 分隔线样式 -->
36+
.postTitle{margin: auto 0;font-size:40px;font-weight:bold;}
37+
<!-- 文章标题样式 -->
38+
.title-right{display:flex;margin:auto 0 0 auto;}
39+
<!-- 标题右侧操作按钮布局 -->
40+
.title-right .circle{padding: 14px 16px;margin-right:8px;}
41+
#postBody{border-bottom: 1px solid var(--color-border-default);padding-bottom:36px;}
42+
<!-- 文章主体内容样式 -->
43+
#postBody hr{height:2px;}
44+
<!-- 分隔线样式 -->
2445
@media (max-width: 600px) {
2546
body {padding: 8px;}
2647
.postTitle{font-size:24px;}
2748
}
49+
<!-- 响应式样式,针对小于600px的屏幕 -->
2850
</style>
2951
{{ blogBase['style'] }}
30-
52+
<!-- 引入页面额外样式 -->
3153
{% endblock %}
54+
3255
{% block header %}
56+
<!-- 页面头部内容 -->
3357
<h1 class="postTitle">{{ blogBase['postTitle'] }}</h1>
58+
<!-- 显示文章标题 -->
3459
<div class="title-right">
60+
<!-- 标题右侧操作按钮区域 -->
3561
<a href="{{ blogBase['homeUrl'] }}" id="buttonHome" class="btn btn-invisible circle" title="{{ i18n['home'] }}">
62+
<!-- 首页链接按钮 -->
3663
<svg class="octicon" width="16" height="16">
3764
<path id="pathHome" fill-rule="evenodd"></path>
3865
</svg>
3966
</a>
4067
{% if blogBase['showPostSource']==1 %}
4168
<a href="{{ blogBase['postSourceUrl'] }}" target="_blank" class="btn btn-invisible circle" title="Issue">
69+
<!-- 文章源码链接按钮 -->
4270
<svg class="octicon" width="16" height="16">
4371
<path id="pathIssue" fill-rule="evenodd"></path>
4472
</svg>
4573
</a>
4674
{% endif %}
47-
4875
<a class="btn btn-invisible circle" onclick="modeSwitch();" title="{{ i18n['switchTheme'] }}" {%- if blogBase['themeMode']=='fix' -%}style="display:none;"{%- endif -%}>
49-
<svg class="octicon" width="16" height="16" >
76+
<!-- 主题切换按钮 -->
77+
<svg class="octicon" width="16" height="16">
5078
<path id="themeSwitch" fill-rule="evenodd"></path>
5179
</svg>
5280
</a>
53-
5481
</div>
82+
<!-- 结束标题右侧操作按钮区域 -->
5583
{% endblock %}
5684

5785
{% block content %}
86+
<!-- 页面主体内容 -->
5887
<div class="markdown-body" id="postBody">{{ blogBase['postBody'] }}</div>
88+
<!-- 显示文章正文 -->
5989
<div style="font-size:small;margin-top:8px;float:right;">{{ blogBase['bottomText'] }}</div>
60-
<button class="btn btn-block" type="button" onclick="openComments()" id="cmButton">{{ i18n['comments'] }}</button>
61-
<div class="comments" id="comments"></div>
90+
<!-- 底部提示信息 -->
6291
{% endblock %}
6392

6493
{% block script %}
94+
<!-- 页面脚本部分 -->
6595
<script>
6696
document.getElementById("pathHome").setAttribute("d",IconList["home"]);
97+
<!-- 设置首页图标路径 -->
6798
document.getElementById("pathIssue").setAttribute("d",IconList["github"]);
68-
{% if blogBase['commentNum']>0 -%}
69-
cmButton=document.getElementById("cmButton");
70-
span=document.createElement("span");
71-
span.setAttribute("class","Counter");
72-
span.innerHTML="{{ blogBase['commentNum'] }}";
73-
cmButton.appendChild(span);
74-
{%- endif %}
75-
function openComments(){
76-
cm=document.getElementById("comments");
77-
cmButton=document.getElementById("cmButton");
78-
cmButton.innerHTML="loading";
79-
span=document.createElement("span");
80-
span.setAttribute("class","AnimatedEllipsis");
81-
cmButton.appendChild(span);
82-
83-
script=document.createElement("script");
84-
script.setAttribute("src","https://utteranc.es/client.js");
85-
script.setAttribute("repo","{{ blogBase['repoName'] }}");
86-
script.setAttribute("issue-term","title");
87-
{% if blogBase['themeMode']=='manual' %}
88-
if(localStorage.getItem("meek_theme")=="dark"){script.setAttribute("theme","dark-blue");}
89-
else if(localStorage.getItem("meek_theme")=="light") {script.setAttribute("theme","github-light");}
90-
else{script.setAttribute("theme","preferred-color-scheme");}
91-
{% else %}
92-
script.setAttribute("theme","{{ blogBase['nightTheme'] }}");
93-
{% endif %}
94-
script.setAttribute("crossorigin","anonymous");
95-
script.setAttribute("async","");
96-
cm.appendChild(script);
97-
98-
int=self.setInterval("iFrameLoading()",200);
99-
}
100-
101-
function iFrameLoading(){
102-
var utterances=document.getElementsByClassName('utterances');
103-
if(utterances.length==1){
104-
if(utterances[0].style.height!=""){
105-
utterancesLoad=1;
106-
int=window.clearInterval(int);
107-
document.getElementById("cmButton").style.display="none";
108-
console.log("utterances Load OK");
109-
}
110-
}
111-
}
99+
<!-- 设置源码图标路径 -->
112100
</script>
113101
{{ blogBase['script'] }}
114-
{% endblock %}
102+
<!-- 引入页面特定脚本 -->
103+
{% endblock %}

0 commit comments

Comments
 (0)