Replace {{ .URL }} with {{ .Permalink }} (#216)
Using the `{{ .URL }}` token results in a warning: WARN 2019/10/13 15:12:12 Page's .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. Steps to reproduce ================== Follow along with the Quick Start guide at https://gohugo.io/getting-started/quick-start/ Running `hugo server -D` emits a warning that `.URL` is deprecated.
This commit is contained in:
parent
7cb108bd54
commit
0d9656d939
|
@ -37,7 +37,7 @@
|
||||||
{{/* Now, range through the next four after the initial $n_posts items. Nest the requirements, "after" then "first" on the outside */}}
|
{{/* Now, range through the next four after the initial $n_posts items. Nest the requirements, "after" then "first" on the outside */}}
|
||||||
{{ range (first 4 (after $n_posts $section)) }}
|
{{ range (first 4 (after $n_posts $section)) }}
|
||||||
<h2 class="f5 fw4 mb4 dib mr3">
|
<h2 class="f5 fw4 mb4 dib mr3">
|
||||||
<a href="{{ .URL }}" class="link black dim">
|
<a href="{{ .Permalink }}" class="link black dim">
|
||||||
{{ .Title }}
|
{{ .Title }}
|
||||||
</a>
|
</a>
|
||||||
</h2>
|
</h2>
|
||||||
|
@ -45,7 +45,7 @@
|
||||||
|
|
||||||
{{/* As above, Use $section_name to get the section title, and URL. Use "with" to only show it if it exists */}}
|
{{/* As above, Use $section_name to get the section title, and URL. Use "with" to only show it if it exists */}}
|
||||||
{{ with .Site.GetPage "section" $section_name }}
|
{{ with .Site.GetPage "section" $section_name }}
|
||||||
<a href="{{ .URL }}" class="link db f6 pa2 br3 bg-mid-gray white dim w4 tc">{{ i18n "allTitle" . }}</a>
|
<a href="{{ .Permalink }}" class="link db f6 pa2 br3 bg-mid-gray white dim w4 tc">{{ i18n "allTitle" . }}</a>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
</section>
|
</section>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
<ul class="pl0 mr3">
|
<ul class="pl0 mr3">
|
||||||
{{ range .Site.Menus.main }}
|
{{ range .Site.Menus.main }}
|
||||||
<li class="list f5 f4-ns fw4 dib pr3">
|
<li class="list f5 f4-ns fw4 dib pr3">
|
||||||
<a class="hover-white no-underline white-90" href="{{ .URL }}" title="{{ .Name }} page">
|
<a class="hover-white no-underline white-90" href="{{ .Permalink }}" title="{{ .Name }} page">
|
||||||
{{ .Name }}
|
{{ .Name }}
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
|
|
|
@ -6,21 +6,21 @@
|
||||||
{{/* Trimming the slash and adding absURL make sure the image works no matter where our site lives */}}
|
{{/* Trimming the slash and adding absURL make sure the image works no matter where our site lives */}}
|
||||||
{{ $featured_image := (trim $featured_image "/") | absURL }}
|
{{ $featured_image := (trim $featured_image "/") | absURL }}
|
||||||
<div class="pr3-ns mb4 mb0-ns w-100 w-40-ns">
|
<div class="pr3-ns mb4 mb0-ns w-100 w-40-ns">
|
||||||
<a href="{{.URL}}" class="db grow">
|
<a href="{{.Permalink}}" class="db grow">
|
||||||
<img src="{{ $featured_image }}" class="img" alt="image from {{ .Title }}">
|
<img src="{{ $featured_image }}" class="img" alt="image from {{ .Title }}">
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
<div class="blah w-100{{ if .Params.featured_image }} w-60-ns pl3-ns{{ end }}">
|
<div class="blah w-100{{ if .Params.featured_image }} w-60-ns pl3-ns{{ end }}">
|
||||||
<h1 class="f3 fw1 athelas mt0 lh-title">
|
<h1 class="f3 fw1 athelas mt0 lh-title">
|
||||||
<a href="{{.URL}}" class="color-inherit dim link">
|
<a href="{{.Permalink}}" class="color-inherit dim link">
|
||||||
{{ .Title }}
|
{{ .Title }}
|
||||||
</a>
|
</a>
|
||||||
</h1>
|
</h1>
|
||||||
<div class="f6 f5-l lh-copy nested-copy-line-height nested-links">
|
<div class="f6 f5-l lh-copy nested-copy-line-height nested-links">
|
||||||
{{ .Summary }}
|
{{ .Summary }}
|
||||||
</div>
|
</div>
|
||||||
<a href="{{.URL}}" class="ba b--moon-gray bg-light-gray br2 color-inherit dib f7 hover-bg-moon-gray link mt2 ph2 pv1">{{ $.Param "read_more_copy" | default (i18n "readMore") }}</a>
|
<a href="{{.Permalink}}" class="ba b--moon-gray bg-light-gray br2 color-inherit dib f7 hover-bg-moon-gray link mt2 ph2 pv1">{{ $.Param "read_more_copy" | default (i18n "readMore") }}</a>
|
||||||
{{/* TODO: add author
|
{{/* TODO: add author
|
||||||
<p class="f6 lh-copy mv0">By {{ .Author }}</p> */}}
|
<p class="f6 lh-copy mv0">By {{ .Author }}</p> */}}
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
<div class="bg-white mb3 pa4 gray overflow-hidden">
|
<div class="bg-white mb3 pa4 gray overflow-hidden">
|
||||||
<span class="f6 db">{{ humanize .Section }}</span>
|
<span class="f6 db">{{ humanize .Section }}</span>
|
||||||
<h1 class="f3 near-black">
|
<h1 class="f3 near-black">
|
||||||
<a href="{{ .URL }}" class="link black dim">
|
<a href="{{ .Permalink }}" class="link black dim">
|
||||||
{{ .Title }}
|
{{ .Title }}
|
||||||
</a>
|
</a>
|
||||||
</h1>
|
</h1>
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<article class="bb b--black-10">
|
<article class="bb b--black-10">
|
||||||
<a class="db pv4 ph3 ph0-l no-underline dark-gray dim" href="{{ .URL }}">
|
<a class="db pv4 ph3 ph0-l no-underline dark-gray dim" href="{{ .Permalink }}">
|
||||||
<div class="flex flex-column flex-row-ns">
|
<div class="flex flex-column flex-row-ns">
|
||||||
{{ if .Params.featured_image }}
|
{{ if .Params.featured_image }}
|
||||||
<div class="pr3-ns mb4 mb0-ns w-100 w-40-ns">
|
<div class="pr3-ns mb4 mb0-ns w-100 w-40-ns">
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
</div>
|
</div>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
<h1 class="f3 near-black">
|
<h1 class="f3 near-black">
|
||||||
<a href="{{ .URL }}" class="link black dim">
|
<a href="{{ .Permalink }}" class="link black dim">
|
||||||
{{ .Title }}
|
{{ .Title }}
|
||||||
</a>
|
</a>
|
||||||
</h1>
|
</h1>
|
||||||
|
|
Loading…
Reference in a new issue