瀏覽代碼

fix(widget): Hugo 0.55 broke display of taxonomy term names (e.g. tags)

Prior to this update, Hugo began displaying urlized tags like
`deep-learning` rather than `Deep Learning` in the Tag Cloud widget and
the list_tags/categories shortcodes.

Fix #1072
George Cushen 6 年之前
父節點
當前提交
507523aeb9

+ 1 - 1
layouts/partials/widgets/tag_cloud.html

@@ -24,7 +24,7 @@
           {{ $tagCount := len $taxonomy.Pages }}
           {{ $weight := div (sub (math.Log $tagCount) (math.Log $min)) (sub (math.Log $max) (math.Log $min)) }}
           {{ $fontSize := add $fontSmall (mul (sub $fontBig $fontSmall) $weight) }}
-          <a href="{{ .Page.RelPermalink }}" style="font-size:{{ $fontSize }}rem">{{ $name }}</a>
+          <a href="{{ .Page.RelPermalink }}" style="font-size:{{ $fontSize }}rem">{{ .Page.Title }}</a>
         {{ end }}
       </div>
     {{ end }}

+ 2 - 2
layouts/shortcodes/list_categories.html

@@ -1,5 +1,5 @@
 <ul class="list-unstyled">
-  {{ range (site.GetPage "taxonomyTerm" "categories").Pages }}
-  <li><a href="{{.RelPermalink}}">{{.Title}}</a></li>
+  {{ range site.Taxonomies.categories }}
+  <li><a href="{{.Page.RelPermalink}}">{{.Page.Title}}</a></li>
   {{ end }}
 </ul>

+ 2 - 2
layouts/shortcodes/list_tags.html

@@ -1,5 +1,5 @@
 <ul class="list-unstyled">
-  {{ range (site.GetPage "taxonomyTerm" "tags").Pages }}
-  <li><a href="{{.RelPermalink}}">{{.Title}}</a></li>
+  {{ range site.Taxonomies.tags }}
+  <li><a href="{{.Page.RelPermalink}}">{{.Page.Title}}</a></li>
   {{ end }}
 </ul>