Browse Source

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 years ago
parent
commit
b469743f16
1 changed files with 6 additions and 1 deletions
  1. 6
    1
      layouts/index.html

+ 6
- 1
layouts/index.html View File

@@ -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>