Hugo 学习笔记

随缘装修

  • 文件名不能重

解决:按日期组织文件

Hugo » series

动机: hugo 文章的顺序只是按时间顺序组织, 就有点不太好

添加描述

  • 修改: layouts $>>$ partials $>>$ tile.html
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
        <div class="article-details">
            <h2 class="article-title">
                {{- .context.Title -}}
            </h2>

            <!-- 添加这部分代码来显示文章描述 -->
            {{ if .context.Description }}
            <div class="article-description">
                {{ .context.Description }}
            </div>
            {{ else if .context.Summary }}
            <div class="article-description">
                {{ .context.Summary | truncate 150 }}
            </div>
            {{ end }}     
             <!-- 描述显示代码结束 -->
            
            {{ if eq .Type "taxonomy" }}
                <span class="article-count">{{ len .context.Pages }} 篇文章</span>
            {{ end }}
        </div>