diff options
author | jesselau76 <40444824+jesselau76@users.noreply.github.com> | 2019-02-09 08:19:33 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-02-09 08:19:33 +0300 |
commit | 6b51fac125d68a2d4ba463d161968952b8b10d10 (patch) | |
tree | 5fd94159247999162b04d7f695c9fbbd829c3be5 | |
parent | e4ea4e80164969e819f79f88b71b71faccf94a94 (diff) | |
parent | ca464e2095ef5baf8a19bfdb2039a04675a80bf5 (diff) |
Merge pull request #4 from clintonmasters/master
New feature: Add more control of summaries like hugo-xmag.
-rw-r--r-- | layouts/_default/list.html | 18 |
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) "[…] ") | plainify | truncate (default 200 .Site.Params.summary_length) (default " …" .Site.Params.text.truncated ) | replaceRE "&" "&" | safeHTML) }} + {{ end }} + {{ $.Scratch.Get "summary" }} + </p> + </div> <footer > |