Console warning: Page.URL is deprecated

theme repo GitHub - starsareintherose/npqhugo: npq-hugo is a customizable and responsive dark blog theme with integrated contact form and code syntax highlighting
I just replace .URL to .Permalink, but it reports bug
When I want to fix the warning, it reports this bug

WARN 2021/12/28 23:49:11 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
ERROR 2021/12/28 23:49:11 render of "section" failed: execute of template failed: template: _default/list.html:24:7: executing "main" at <partial "pagination.html" $>: error calling partial: "/root/diary/themes/npq-hugo/layouts/partials/pagination.html:6:34": execute of template failed: template: partials/pagination.html:6:34: executing "partials/pagination.html" at <.Permalink>: can't evaluate field Permalink in type *page.Pager
Error: Error building site: failed to render pages: render of "section" failed: execute of template failed: template: _default/list.html:24:7: executing "main" at <partial "pagination.html" $>: error calling partial: "/root/diary/themes/npq-hugo/layouts/partials/pagination.html:19:34": execute of template failed: template: partials/pagination.html:19:34: executing "partials/pagination.html" at <.Permalink>: can't evaluate field Permalink in type *page.Pager

Post the layout file where that error occurs or make the whole repository available.

When you built the site you saw this warning:

Page.URL is deprecated and will be removed in a future release. Use .Permalink or .RelPermalink.

The message is telling you that .URL has been deprecated in a page context, and only in a page context. In the context of menu entries and pagers .URL is correct:

If you perform a global replacement you will break your site.

The .URL property is referenced in:

File Context Notes
layouts/_default/list.html page Change this
layouts/index.html page Change this
layouts/partials/aside.html menu entry OK
layouts/partials/pagination.html pager OK

Error

Okay, i will try

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.