From d6b86105da35cb066c2bef828d6cfc8b00a79b89 Mon Sep 17 00:00:00 2001 From: Martyn Welch <martyn.welch@collabora.com> Date: Mon, 8 Mar 2021 11:16:42 +0000 Subject: [PATCH] Remove deprecated usage of ".Page.URL" in theme The current theme uses ".URL" in a number of places that is resulting in the current warning message: Page.URL is deprecated and will be removed in a future release. Use .Permalink or .RelPermalink. If what you want is the front matter URL value, use .Params.url Update the usage of this variable to ".Permalink" to stop the warning messages being produced. Signed-off-by: Martyn Welch <martyn.welch@collabora.com> --- themes/beautifulhugo/layouts/_default/list.html | 4 ++-- themes/beautifulhugo/layouts/index.html | 4 ++-- themes/beautifulhugo/layouts/partials/head.html | 4 ++-- themes/beautifulhugo/layouts/partials/nav.html | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/themes/beautifulhugo/layouts/_default/list.html b/themes/beautifulhugo/layouts/_default/list.html index e9f4c65f2..8e3606b73 100644 --- a/themes/beautifulhugo/layouts/_default/list.html +++ b/themes/beautifulhugo/layouts/_default/list.html @@ -63,12 +63,12 @@ <ul class="pager main-pager"> {{ if .Paginator.HasPrev }} <li class="previous"> - <a href="{{ .URL }}page/{{ .Paginator.Prev.PageNumber }}">← {{ i18n "newerPosts" }}</a> + <a href="{{ .Permalink }}page/{{ .Paginator.Prev.PageNumber }}">← {{ i18n "newerPosts" }}</a> </li> {{ end }} {{ if .Paginator.HasNext }} <li class="next"> - <a href="{{ .URL }}page/{{ .Paginator.Next.PageNumber }}">{{ i18n "olderPosts" }} →</a> + <a href="{{ .Permalink }}page/{{ .Paginator.Next.PageNumber }}">{{ i18n "olderPosts" }} →</a> </li> {{ end }} </ul> diff --git a/themes/beautifulhugo/layouts/index.html b/themes/beautifulhugo/layouts/index.html index 55876971a..6089d6340 100644 --- a/themes/beautifulhugo/layouts/index.html +++ b/themes/beautifulhugo/layouts/index.html @@ -46,12 +46,12 @@ <ul class="pager main-pager"> {{ if .Paginator.HasPrev }} <li class="previous"> - <a href="{{ .URL }}page/{{ .Paginator.Prev.PageNumber }}">← {{ i18n "newerPosts" }}</a> + <a href="{{ .Permalink }}page/{{ .Paginator.Prev.PageNumber }}">← {{ i18n "newerPosts" }}</a> </li> {{ end }} {{ if .Paginator.HasNext }} <li class="next"> - <a href="{{ .URL }}page/{{ .Paginator.Next.PageNumber }}">{{ i18n "olderPosts" }} →</a> + <a href="{{ .Permalink }}page/{{ .Paginator.Next.PageNumber }}">{{ i18n "olderPosts" }} →</a> </li> {{ end }} </ul> diff --git a/themes/beautifulhugo/layouts/partials/head.html b/themes/beautifulhugo/layouts/partials/head.html index cf1be01d2..18ddac028 100644 --- a/themes/beautifulhugo/layouts/partials/head.html +++ b/themes/beautifulhugo/layouts/partials/head.html @@ -30,13 +30,13 @@ {{- with .Site.Params.fb_app_id }} <meta property="fb:app_id" content="{{ . }}" /> {{- end }} - <meta property="og:url" content="{{ .URL | absLangURL }}" /> + <meta property="og:url" content="{{ .Permalink | absLangURL }}" /> <meta property="og:type" content="website" /> <meta property="og:site_name" content="{{ .Site.Title }}" /> <!-- Hugo Version number --> {{ hugo.Generator -}} <!-- Links and stylesheets --> - <link rel="canonical" href="{{ .URL | absLangURL }}" /> + <link rel="canonical" href="{{ .Permalink | absLangURL }}" /> <link rel="alternate" href="{{ "index.xml" | absLangURL }}" type="application/rss+xml" title="{{ .Site.Title }}"> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.7.1/katex.min.css" integrity="sha384-wITovz90syo1dJWVh32uuETPVEtGigN07tkttEqPv+uR2SE/mbQcG7ATL28aI9H0" crossorigin="anonymous"> <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.0.13/css/all.css" integrity="sha384-DNOHZ68U8hZfKXOrtjWvjxusGo9WQnrNx2sqG0tfsghAvtVlRW3tvkXWZh58N9jp" crossorigin="anonymous"> diff --git a/themes/beautifulhugo/layouts/partials/nav.html b/themes/beautifulhugo/layouts/partials/nav.html index 2e24d6c5e..f6b38d8cb 100644 --- a/themes/beautifulhugo/layouts/partials/nav.html +++ b/themes/beautifulhugo/layouts/partials/nav.html @@ -80,13 +80,13 @@ {{ $section := .FirstSection }} {{ range sort .Site.Sections.ByTitle }} <li class="sidebar-section"> - <a href="{{ .URL | relLangURL }}" + <a href="{{ .Permalink | relLangURL }}" {{ if eq .FirstSection $section }}id="sidebar-focus" class="sidebar-focus"{{end}}>{{ .Title }}</a> <div class="sidebar-pages"> <ul> {{ range .Pages.ByTitle }} <li class="sidebar-page"> - <a href="{{ .URL | relLangURL }}">{{ .Name }}</a> + <a href="{{ .Permalink | relLangURL }}">{{ .Name }}</a> </li> {{ end }} </ul> -- GitLab