Bläddra i källkod

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.
Slashdoom 5 år sedan
förälder
incheckning
6c86640af4
1 ändrade filer med 2 tillägg och 1 borttagningar
  1. 2 1
      layouts/partials/widgets/tag_cloud.html

+ 2 - 1
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 }}