From 6c86640af43b244eb096f9e53a2c1cc687070c2c Mon Sep 17 00:00:00 2001 From: Slashdoom <5092581+slashdoom@users.noreply.github.com> Date: Sun, 29 Dec 2019 09:44:44 +1300 Subject: [PATCH] fix(widget): tag cloud max size calculation (#1497) Calculate max value first since the list is mutable to Hugo's `Reverse` function - i.e. Hugo's `Reverse` function currently appears to operate in-place. --- layouts/partials/widgets/tag_cloud.html | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/layouts/partials/widgets/tag_cloud.html b/layouts/partials/widgets/tag_cloud.html index f8488cd9..595d0759 100644 --- a/layouts/partials/widgets/tag_cloud.html +++ b/layouts/partials/widgets/tag_cloud.html @@ -29,8 +29,9 @@ {{ if ne $count 0 }} {{ $fontDelta := sub $fontBig $fontSmall }} - {{ $min := len (index ($tags).Reverse 0).Pages }} + {{/* Warning: Hugo's `Reverse` function appears to operate in-place, hence the order of performing $max/$min matters. */}} {{ $max := add (len (index $tags 0).Pages) 1 }} + {{ $min := len (index ($tags).Reverse 0).Pages }} {{ $delta := sub $max $min }} {{ $fontStep := div $fontDelta $delta }}