瀏覽代碼

Implement Content Summaries / Split on index page

Posts in the index page will be automatically summarized to its first 70
words, or until a user-defined <!--more--> divider. When summarized, the
"Read More" button also appears with a RelPermalink to the full post.

https://gohugo.io/content-management/summaries/
JinGen Lim 7 年之前
父節點
當前提交
b469743f16
共有 1 個檔案被更改,包括 6 行新增1 行删除
  1. 6
    1
      layouts/index.html

+ 6
- 1
layouts/index.html 查看文件

@@ -6,7 +6,12 @@
6 6
     <a href="{{ .Permalink }}">{{ .Title }}</a>
7 7
   </h1>
8 8
   <span class="post-date">{{ .Date.Format "Mon, Jan 2, 2006" }}</span>
9
-  {{ .Content }}
9
+  {{ .Summary }}
10
+  {{ if .Truncated }}
11
+  <div class="read-more-link">
12
+    <a href="{{ .RelPermalink }}">Read More…</a>
13
+  </div>
14
+  {{ end }}
10 15
 </div>
11 16
 {{- end }}
12 17
 </div>