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

github.com/it-gro/hugo-theme-w3css-basic.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorit-gro <13005925+it-gro@users.noreply.github.com>2019-08-23 09:52:28 +0300
committerit-gro <13005925+it-gro@users.noreply.github.com>2019-08-23 09:52:28 +0300
commitaf6f875fbb09a775bc2dcea2a70ff45569a2c4f5 (patch)
tree7f8cc7362ab043e4e3200cf74755dccc1a09d6bc
parentc75d24d09a1a2d9d87f0f806a277244287132ff6 (diff)
Use .Param for teaserTruncateSummary => Page (Frontmatter) or Site (config.yaml) setting
-rw-r--r--layouts/partials/main.teaser_in_card.html11
1 files changed, 10 insertions, 1 deletions
diff --git a/layouts/partials/main.teaser_in_card.html b/layouts/partials/main.teaser_in_card.html
index 1f15701..b865782 100644
--- a/layouts/partials/main.teaser_in_card.html
+++ b/layouts/partials/main.teaser_in_card.html
@@ -23,7 +23,16 @@
{{- if eq .Type `blog` }}
<div class="w3-right"><i class="far fa-calendar" aria-hidden="true"></i>&nbsp;<i>{{- partial `main.i18n.date.short.html` . -}}</i></div>
{{- end }}
- {{- or .Description .Summary | markdownify | truncate ( or $.Site.Params.teaserTruncateSummary 160) | replaceRE `<.?p>` `` | safeHTML }}
+ {{- /* or .Description .Summary | markdownify | truncate ( or $.Site.Params.teaserTruncateSummary 160) | replaceRE `<.?p>` `` | safeHTML */}}
+ {{- $myTruncateLength := or (.Param "teaserTruncateSummary") 160 }}
+ {{- or .Description .Summary | markdownify | replaceRE `<.?p>` `` | safeHTML | truncate $myTruncateLength }}
+{{- /*
+<br>
+len .Description : {{ len .Description}} <br>
+len .Summary : {{ len .Summary}} <br>
+$myTruncateLength: {{ $myTruncateLength }} <br>
+*/}}
+
</div>
</a>