Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/jesselau76/hugo-w3-simple.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClinton Masters <10438162+clintonmasters@users.noreply.github.com>2019-02-08 04:21:09 +0300
committerClinton Masters <10438162+clintonmasters@users.noreply.github.com>2019-02-08 04:21:09 +0300
commitca464e2095ef5baf8a19bfdb2039a04675a80bf5 (patch)
tree5fd94159247999162b04d7f695c9fbbd829c3be5
parente4ea4e80164969e819f79f88b71b71faccf94a94 (diff)
New feature: Add more control of summaries like hugo-xmag. See https://yihui.name/en/2017/08/hugo-post-summary/
-rw-r--r--layouts/_default/list.html18
1 files changed, 9 insertions, 9 deletions
diff --git a/layouts/_default/list.html b/layouts/_default/list.html
index c128195..0669cb2 100644
--- a/layouts/_default/list.html
+++ b/layouts/_default/list.html
@@ -56,16 +56,16 @@
<div class="w3-container wraptext w3-white">
<code> {{ .Date.Format "2006/01/02" }} </code>
-
-
- {{ if gt (len .Summary) 200 }}
-
-
- <p>{{substr .Summary 0 200 }}...</p>
-
-
- {{ end }}
+ <p>
+ {{ with .Description }}
+ {{ $.Scratch.Set "summary" (markdownify .) }}
+ {{ else }}
+ {{ $.Scratch.Set "summary" ((delimit (findRE "(<p.*?>(.|\n)*?</p>\\s*)+" .Content) "[&hellip;] ") | plainify | truncate (default 200 .Site.Params.summary_length) (default " &hellip;" .Site.Params.text.truncated ) | replaceRE "&amp;" "&" | safeHTML) }}
+ {{ end }}
+ {{ $.Scratch.Get "summary" }}
+ </p>
+
</div>
<footer >