]> njoseph.me Git - hyde.git/commitdiff
Implement Content Summaries / Split on index page
authorJinGen Lim <jingen@cows.dontexist.org>
Sun, 1 Oct 2017 03:26:37 +0000 (11:26 +0800)
committerJinGen Lim <jingen@cows.dontexist.org>
Sun, 1 Oct 2017 03:26:37 +0000 (11:26 +0800)
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/

layouts/index.html

index 3fed5be4dab4b58aeb31e5d63f56afa5a1f9fdec..209009e3b140d354a5b6e4c5cf6ad21a1088d3d1 100644 (file)
@@ -6,7 +6,12 @@
     <a href="{{ .Permalink }}">{{ .Title }}</a>
   </h1>
   <span class="post-date">{{ .Date.Format "Mon, Jan 2, 2006" }}</span>
-  {{ .Content }}
+  {{ .Summary }}
+  {{ if .Truncated }}
+  <div class="read-more-link">
+    <a href="{{ .RelPermalink }}">Read Moreā€¦</a>
+  </div>
+  {{ end }}
 </div>
 {{- end }}
 </div>