Fix deprecated .Hugo, .UniqueID and .URL references

This commit is contained in:
James Booker 2019-06-13 10:05:25 +01:00 committed by Matthew Taylor
parent 15eb41a107
commit eb0ad9c489
7 changed files with 14 additions and 14 deletions

View file

@ -7,7 +7,7 @@
{{ if or (eq .Kind "taxonomy") (eq .Kind "taxonomyTerm") }} {{ if or (eq .Kind "taxonomy") (eq .Kind "taxonomyTerm") }}
<ul> <ul>
{{ range .Pages }} {{ range .Pages }}
<li><a href="{{.URL}}">{{.Title}}</a></li> <li><a href="{{.RelPermalink}}">{{.Title}}</a></li>
{{ end }} {{ end }}
</ul> </ul>
{{end}} {{end}}

View file

@ -14,7 +14,7 @@
{{ define "menu-nextprev" }} {{ define "menu-nextprev" }}
{{$currentNode := .currentnode }} {{$currentNode := .currentnode }}
{{ if ne .menu.Params.hidden true}} {{ if ne .menu.Params.hidden true}}
{{if hasPrefix $currentNode.URL .menu.URL }} {{if hasPrefix $currentNode.RelPermalink .menu.RelPermalink }}
{{ $currentNode.Scratch.Set "NextPageOK" "OK" }} {{ $currentNode.Scratch.Set "NextPageOK" "OK" }}
{{ $currentNode.Scratch.Set "prevPage" ($currentNode.Scratch.Get "prevPageTmp") }} {{ $currentNode.Scratch.Set "prevPage" ($currentNode.Scratch.Get "prevPageTmp") }}
{{else}} {{else}}
@ -43,10 +43,10 @@
{{$showPrevNext := (and (not .Params.disableNextPrev) (not .Site.Params.disableNextPrev))}} {{$showPrevNext := (and (not .Params.disableNextPrev) (not .Site.Params.disableNextPrev))}}
{{if $showPrevNext}} {{if $showPrevNext}}
{{with ($.Scratch.Get "prevPage")}} {{with ($.Scratch.Get "prevPage")}}
<a class="nav nav-prev" href="{{.URL}}" title="{{.Title}}"> <i class="fa fa-chevron-left"></i></a> <a class="nav nav-prev" href="{{.RelPermalink}}" title="{{.Title}}"> <i class="fa fa-chevron-left"></i></a>
{{end}} {{end}}
{{with ($.Scratch.Get "nextPage")}} {{with ($.Scratch.Get "nextPage")}}
<a class="nav nav-next" href="{{.URL}}" title="{{.Title}}" style="margin-right: 0px;"><i class="fa fa-chevron-right"></i></a> <a class="nav nav-next" href="{{.RelPermalink}}" title="{{.Title}}" style="margin-right: 0px;"><i class="fa fa-chevron-right"></i></a>
{{end}} {{end}}
{{end}} {{end}}
</div> </div>

View file

@ -3,7 +3,7 @@
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
{{ .Hugo.Generator }} {{ hugo.Generator }}
{{ partial "meta.html" . }} {{ partial "meta.html" . }}
{{ partial "favicon.html" . }} {{ partial "favicon.html" . }}
<title>{{ .Title }} :: {{ .Site.Title }}</title> <title>{{ .Title }} :: {{ .Site.Title }}</title>
@ -100,7 +100,7 @@
{{define "breadcrumb"}} {{define "breadcrumb"}}
{{$parent := .page.Parent }} {{$parent := .page.Parent }}
{{ if $parent }} {{ if $parent }}
{{ $value := (printf "<a href='%s'>%s</a> > %s" $parent.URL $parent.Title .value) }} {{ $value := (printf "<a href='%s'>%s</a> > %s" $parent.RelPermalink $parent.Title .value) }}
{{ template "breadcrumb" dict "page" $parent "value" $value }} {{ template "breadcrumb" dict "page" $parent "value" $value }}
{{else}} {{else}}
{{.value|safeHTML}} {{.value|safeHTML}}

View file

@ -32,7 +32,7 @@
<ul> <ul>
{{ range sort . "Weight"}} {{ range sort . "Weight"}}
<li> <li>
{{.Pre}}<a class="padding" href="{{.URL | absLangURL }}">{{safeHTML .Name}}</a>{{.Post}} {{.Pre}}<a class="padding" href="{{.RelPermalink | absLangURL }}">{{safeHTML .Name}}</a>{{.Post}}
</li> </li>
{{end}} {{end}}
</ul> </ul>
@ -97,9 +97,9 @@
{{with .sect}} {{with .sect}}
{{if .IsSection}} {{if .IsSection}}
{{safeHTML .Params.head}} {{safeHTML .Params.head}}
<li data-nav-id="{{.URL}}" title="{{.Title}}" class="dd-item <li data-nav-id="{{.RelPermalink}}" title="{{.Title}}" class="dd-item
{{if .IsAncestor $currentNode }}parent{{end}} {{if .IsAncestor $currentNode }}parent{{end}}
{{if eq .UniqueID $currentNode.UniqueID}}active{{end}} {{if eq .File.UniqueID $currentNode.File.UniqueID}}active{{end}}
{{if .Params.alwaysopen}}parent{{end}} {{if .Params.alwaysopen}}parent{{end}}
"> ">
<a href="{{.RelPermalink}}"> <a href="{{.RelPermalink}}">
@ -137,7 +137,7 @@
</li> </li>
{{else}} {{else}}
{{ if not .Params.Hidden }} {{ if not .Params.Hidden }}
<li data-nav-id="{{.URL}}" title="{{.Title}}" class="dd-item {{if eq .UniqueID $currentNode.UniqueID}}active{{end}}"> <li data-nav-id="{{.RelPermalink}}" title="{{.Title}}" class="dd-item {{if eq .File.UniqueID $currentNode.File.UniqueID}}active{{end}}">
<a href="{{ .RelPermalink}}"> <a href="{{ .RelPermalink}}">
{{safeHTML .Params.Pre}}{{or .Params.menuTitle .LinkTitle .Title}}{{safeHTML .Params.Post}} {{safeHTML .Params.Pre}}{{or .Params.menuTitle .LinkTitle .Title}}{{safeHTML .Params.Post}}
{{ if $showvisitedlinks}}<i class="fas fa-check read-icon"></i>{{end}} {{ if $showvisitedlinks}}<i class="fas fa-check read-icon"></i>{{end}}

View file

@ -47,12 +47,12 @@
{{$numn := add $num $.count }} {{$numn := add $num $.count }}
{{(printf "<h%d>" $numn)|safeHTML}} {{(printf "<h%d>" $numn)|safeHTML}}
<a href="{{.URL}}" >{{ .Title }}</a> <a href="{{.RelPermalink}}" >{{ .Title }}</a>
{{(printf "</h%d>" $numn)|safeHTML}} {{(printf "</h%d>" $numn)|safeHTML}}
{{else}} {{else}}
{{(printf "<%s>" $.style)|safeHTML}} {{(printf "<%s>" $.style)|safeHTML}}
<a href="{{.URL}}" >{{ .Title }}</a> <a href="{{.RelPermalink}}" >{{ .Title }}</a>
{{(printf "</%s>" $.style)|safeHTML}} {{(printf "</%s>" $.style)|safeHTML}}
{{end}} {{end}}

View file

@ -7,7 +7,7 @@
{{- end -}} {{- end -}}
{{- else -}} {{- else -}}
{{- with .Site.GetPage "section" (.Get 0) }} {{- with .Site.GetPage "section" (.Get 0) }}
{{- .URL -}} {{- .RelPermalink -}}
{{- else -}} {{- else -}}
{{- .Get 0 | relref .Page -}} {{- .Get 0 | relref .Page -}}
{{- end -}} {{- end -}}

View file

@ -7,7 +7,7 @@
{{- end -}} {{- end -}}
{{- else -}} {{- else -}}
{{- with .Site.GetPage "section" (.Get 0) }} {{- with .Site.GetPage "section" (.Get 0) }}
{{- .URL -}} {{- .RelPermalink -}}
{{- else -}} {{- else -}}
{{- .Get 0 | relref .Page -}} {{- .Get 0 | relref .Page -}}
{{- end -}} {{- end -}}