Commit 7c038718 authored by Kaushal Modi's avatar Kaushal Modi

Refactor to make .Site.GetPage "futureproof"

- .Site.GetPage will most likely accept only 2 arguments in future.

So replace `.Site.GetPage "foo" "bar" "zoo"` with `.Site.GetPage "foo"
"bar/zoo"`.

See https://github.com/gohugoio/hugo/pull/4955#issuecomment-405565928.
parent 79ed929a
......@@ -9,7 +9,7 @@
 
<i class="{{ $.Param "fontawesome.style" | default "fal" }} {{ $icon }}"></i>&nbsp;&nbsp;
{{ range $cnt, $taxo_term := $taxo_list }}
{{ with $.Site.GetPage "taxonomy" $taxo ($taxo_term | urlize) }}
{{ with $.Site.GetPage "taxonomy" (printf "%s/%s" $taxo ($taxo_term | urlize)) }}
<a class="p-category" href="{{ .Permalink }}">{{ $taxo_term }}</a>
{{ end }}
{{ if lt $cnt (sub $count 1) }}
......
......@@ -8,7 +8,7 @@
<ul>
{{ range .Data.Terms.ByCount }}
{{ $count := .Count }}
{{ with $.Site.GetPage "taxonomy" $type (.Name | urlize) }} <!-- .Name in OrderedTaxonomyEntry object -->
{{ with $.Site.GetPage "taxonomy" (printf "%s/%s" $type (.Name | urlize)) }} <!-- .Name in OrderedTaxonomyEntry object -->
<li>
<a href="{{ .Permalink }}">{{ .Name }}</a> ({{ $count }}) <!-- .Name in Page -->
</li>
......
......@@ -13,7 +13,7 @@
{{ $count := .Count }}
{{ $count_div_5 := (div .Count 5) }} <!-- intentionally getting truncated value -->
{{ $term := .Term }}
{{ with $.Site.GetPage "taxonomy" $type $term }}
{{ with $.Site.GetPage "taxonomy" (printf "%s/%s" $type $term) }}
<!-- Provision put in for up to 5*(19+1) = 100 posts for any tag/cateogry. -->
<li class="{{ printf "x%02d" (cond (gt $count_div_5 19) 19 $count_div_5) }}"
title="{{ printf "%d post%s with %s ‘%s’" $count (cond (gt $count 1) "s" "") $singular $term }}">
......
......@@ -6,7 +6,7 @@
{{ range . }}
{{ $term := . }}
{{ $term_urlized := (. | urlize) }}
{{ with $.Site.GetPage "taxonomy" $taxo $term_urlized }}
{{ with $.Site.GetPage "taxonomy" (printf "%s/%s" $taxo $term_urlized) }}
<!-- Each "taxonomy" Kind page has .Data.FOO element.
That FOO is the singular form of the taxo,
like "tag" or "category".
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment