1+ ---
2+ # 布局的前置元数据,可被Jekyll解析
3+ layout: default # 继承默认布局(minima主题核心布局,复用header/footer)
4+ ---
5+
6+ <!-- 文章主体容器 -->
7+ < main class ="post-content " aria-label ="Content ">
8+ < div class ="wrapper ">
9+ <!-- 文章头部信息:标题、日期、分类、标签 -->
10+ < article class ="post h-entry " itemscope itemtype ="http://schema.org/BlogPosting ">
11+ <!-- 文章标题 -->
12+ < header class ="post-header ">
13+ < h1 class ="post-title p-name " itemprop ="name headline ">
14+ {{ page.title | escape }} <!-- 渲染文章标题,escape防止XSS -->
15+ </ h1 >
16+
17+ <!-- 文章元信息:日期、分类、标签 -->
18+ < div class ="post-meta ">
19+ <!-- 发布日期 -->
20+ < time class ="dt-published " datetime ="{{ page.date | date_to_xmlschema }} " itemprop ="datePublished ">
21+ {{ page.date | date: "%Y年%m月%d日 %H:%M" }} <!-- 格式化日期为中文显示 -->
22+ </ time >
23+
24+ <!-- 文章分类(如果有) -->
25+ {% if page.categories.size > 0 %}
26+ < span class ="post-categories ">
27+ 分类:
28+ {% for category in page.categories %}
29+ < a href ="{{ site.baseurl }}/categories/{{ category | slugify }} "> {{ category }}</ a >
30+ {% unless forloop.last %}, {% endunless %} <!-- 分类之间加逗号,最后一个不加 -->
31+ {% endfor %}
32+ </ span >
33+ {% endif %}
34+
35+ <!-- 文章标签(如果有) -->
36+ {% if page.tags.size > 0 %}
37+ < span class ="post-tags ">
38+ 标签:
39+ {% for tag in page.tags %}
40+ < a href ="{{ site.baseurl }}/tags/{{ tag | slugify }} "> {{ tag }}</ a >
41+ {% unless forloop.last %}, {% endunless %}
42+ {% endfor %}
43+ </ span >
44+ {% endif %}
45+ </ div >
46+ </ header >
47+
48+ <!-- 文章正文内容 -->
49+ < div class ="post-content e-content " itemprop ="articleBody ">
50+ {{ content }} <!-- 渲染文章Markdown解析后的正文 -->
51+ </ div >
52+
53+ <!-- 评论区(Utterances,对应_config.yml的配置) -->
54+ {% if page.comments != false %} <!-- 若文章未关闭评论则显示 -->
55+ < div class ="post-comments ">
56+ < h3 > 评论区</ h3 >
57+ < script src ="https://utteranc.es/client.js "
58+ repo ="{{ site.comments.utterances.repo }} "
59+ issue-term ="pathname "
60+ label ="comment "
61+ theme ="github-light "
62+ crossorigin ="anonymous "
63+ async >
64+ </ script >
65+ </ div >
66+ {% endif %}
67+
68+ <!-- 结构化数据标记(SEO优化) -->
69+ < meta itemprop ="author " content ="{{ site.author.name }} ">
70+ < meta itemprop ="description " content ="{{ page.excerpt | default: site.description | strip_html | truncate: 160 }} ">
71+ </ article >
72+ </ div >
73+ </ main >
0 commit comments