Hugo

Page's .URL is deprecated

WARN 2019/09/07 23:41:09 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.

Hello!

I am not sure whether you are asking a question. But the output is the expected behaviour. Just replace .URL in your template files with .Permalink or .RelPermalink.

How to {{.Paginator.Next.URL}} ? Change to?

Read what @Grob said

I have changed the .URL to. Permalink … and nothing has changed

If I am properly informed .URL for .Paginator is correct.

This works for me:

{{ if .Paginator.HasNext }}
  <a href="{{ .Paginator.Next.URL }}">Next</a>
{{ end }}

If you still get the error message you mentioned above, my guess is that .URL is used in another template file.

I have code like this

 <ul id="post-list" class="archive readmore">
<h3>{{ .Site.Params.readMore | default "Read more" }}</h3>

{{ $kind := where .Site.RegularPages "Section" "!=" "" }}
{{ $othr := where $kind "URL" "!=" .URL }}
{{ range first 10 $othr }}
    <li>
        <a href="{{ .URL }}">{{ .LinkTitle }}<aside class="dates">{{ .Date.Format "Jan 2 2006" }}</aside></a>
    </li>
{{ end }}

Ok, I see what you mean.

As mentioned above you just need to replace .URL with .Permalink, but also "URL" with "Permalink".

This snippet works for me with Hugo 0.58.1:

{{ $kind := where .Site.RegularPages "Section" "!=" "" }}
{{ $othr := where $kind "Permalink" "!=" .Permalink }}
{{ range first 10 $othr }}
    <li>
        <a href="{{ .Permalink }}">{{ .LinkTitle }}<aside class="dates">{{ .Date.Format "Jan 2 2006" }}</aside></a>
    </li>
{{ end }}
1 Like

Thanks solved kang hihihi