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

github.com/dataCobra/hugo-vitae.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordataCobra <datacobra@thinkbot.de>2020-12-17 10:27:37 +0300
committerdataCobra <datacobra@thinkbot.de>2020-12-17 10:27:37 +0300
commit32489b970398e1eaa8a93ec76f7fc5761a79acd6 (patch)
treeafaf6f1cdbd0d1f78e7c8852d749aa93f496f63d
parente1a3861f26af02bcdfc33b5c3a8a7996b358ae6c (diff)
Fix #40 (terms.html gives back error for 0 value)2.1.4-1
-rw-r--r--layouts/_default/terms.html11
1 files changed, 6 insertions, 5 deletions
diff --git a/layouts/_default/terms.html b/layouts/_default/terms.html
index 13024c4..6bf8555 100644
--- a/layouts/_default/terms.html
+++ b/layouts/_default/terms.html
@@ -1,11 +1,11 @@
{{ define "main" -}}
<h1 class="page-title">{{ .Name }}</h1>
<div class="tag-cloud">
- {{ $max := len (index $.Site.Taxonomies.tags.ByCount 0).Pages }}
- {{ $min := len (index $.Site.Taxonomies.tags.ByCount.Reverse 0).Pages }}
-
- {{ $maxFontSize := 2.5 }}
- {{ $minFontSize := 1.0 }}
+ {{ if .Data.Terms }}
+ {{ $max := add (len (index $.Data.Terms.ByCount 0).Pages) 0.001 }}
+ {{ $min := len (index $.Data.Terms.ByCount.Reverse 0).Pages }}
+ {{ $maxFontSize := 3.0 }}
+ {{ $minFontSize := 1.5 }}
{{ $steps := div (sub $maxFontSize $minFontSize) (sub $max $min) }}
{{ $data := .Data }}
@@ -16,5 +16,6 @@
{{ $curFontSize := (add $minFontSize (mul (sub $maxFontSize $minFontSize) $weigth) ) }}
<a style="font-size: {{ $curFontSize }}rem;" href="{{ absURL $data.Plural }}/{{ $value.Name }}/">{{ $value.Name }}<sup>{{ $value.Count }}</sup></a>
{{ end }}
+ {{ end }}
</div>
{{ end }}