Commit 2d50220c authored by Kaushal Modi's avatar Kaushal Modi

Update .Site.GetPage syntax to the new version in Hugo v0.45

Now .Site.GetPage canonically accepts only one argument. The Kind
argument is not needed.

https://gohugo.io/functions/getpage/
parent 7ed47565
......@@ -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" (printf "/%s/%s" $taxo ($taxo_term | urlize)) }}
{{ with $.Site.GetPage (printf "/%s/%s" $taxo ($taxo_term | urlize)) }}
<a class="p-category" href="{{ .Permalink }}">{{ $taxo_term }}</a>
{{ end }}
{{ if lt $cnt (sub $count 1) }}
......
......@@ -55,7 +55,7 @@
{{ range $taxo,$_ := . }} <!-- Defaults taxos: "tags", "categories" -->
{{ with $page.Param $taxo }}
{{ $taxo_list := . }} <!-- $taxo_list will be the tags/categories list -->
{{ with $.Site.GetPage "taxonomyTerm" $taxo }}
{{ with $.Site.GetPage (printf "/%s" $taxo) }}
{{ $taxonomy_page := . }}
{{ range $taxo_list }} <!-- Below, assuming pretty URLs -->
<category domain="{{ printf "%s%s" $taxonomy_page.Permalink (. | urlize) }}">{{ . }}</category>
......
......@@ -8,7 +8,7 @@
<ul>
{{ range .Data.Terms.ByCount }}
{{ $count := .Count }}
{{ with $.Site.GetPage "taxonomy" (printf "/%s/%s" $type (.Name | urlize)) }} <!-- .Name in OrderedTaxonomyEntry object -->
{{ with $.Site.GetPage (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" (printf "/%s/%s" $type $term) }}
{{ with $.Site.GetPage (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 }}">
......
......@@ -12,7 +12,7 @@
<!-- Do not print "all tags" link on a "tags" taxonomyTerm page, and same for other taxos. -->
{{ $allow_current_taxo__taxonomyTerm := (and (eq $.Page.Kind "taxonomyTerm") (ne $.Page.Type $taxo) (ne $taxo "series")) }}
{{ if (or $allow_current_taxo__taxonomy $allow_current_taxo__taxonomyTerm) }}
{{ with $.Site.GetPage "taxonomyTerm" $taxo }}
{{ with $.Site.GetPage (printf "/%s" $taxo) }}
{{ $pipe_maybe := (cond ($.Scratch.Get $scratch_var) "" " | ") }}
{{ printf `<span class="%s">%s<a href="%s">all <span class="term">%s</span></a></span>` $taxo $pipe_maybe .Permalink $taxo | safeHTML }}
{{ $.Scratch.Set $scratch_var false }}
......
......@@ -3,11 +3,11 @@
<ul class="navbar">
<li><a class="{{ if eq .Kind "home" }}active{{ end }}" href="/">Home</a></li>
{{ range $.Site.Params.mainSections }}
{{ with $.Site.GetPage "section" . }}
{{ with $.Site.GetPage (printf "/%s" .) }}
<li><a class="{{ if eq $page_relpermalink .RelPermalink }}active{{ end }}" href="{{ .Permalink }}">{{ .Type | title }}</a></li>
{{ end }}
{{ end }}
{{ with .Site.GetPage "page" "search" }}
{{ with .Site.GetPage "/search" }}
<li><a class="{{ if eq $page_relpermalink .RelPermalink }}active{{ end }}" href="{{ .Permalink }}">{{ .Title }}</a></li>
{{ end }}
</ul>
......
......@@ -6,7 +6,7 @@
{{ range . }}
{{ $term := . }}
{{ $term_urlized := (. | urlize) }}
{{ with $.Site.GetPage "taxonomy" (printf "/%s/%s" $taxo $term_urlized) }}
{{ with $.Site.GetPage (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