Can’t evaluate field URL in type page.Page

Hi everybody,

I am a total amateur and I made a very basic website with Hugo two years ago.

Now I would like to make some small changes but when I try to launch the server I get an error, but I didn’t change anything.

Error: Error building site: failed to render pages: render of “section” failed: “/home/****/Hugo/********/themes/ga-hugo-theme/layouts/_default/list.html:14:31”: execute of template failed: template: _default/list.html:14:31: executing “_default/list.html” at <.URL>: can’t evaluate field URL in type page.Page

I’m on linux if that helps. I apologise for the newbie question.

Any help is greatly appreciated.

The .URL method on .Page was deprecated a long time ago. Use .RelPermalink instead.

Do not try to do a global search/replace on your codebase—the .URL method is valid for menu entries and pagination pagers.

1 Like

Likely one of the recent times you’ve updated your Linux instance via its package manager, it may have updated Hugo to a more recent version after the depreciation of .URL for pages.

I’d suggest searching for .URL, and then changing each instance to .RelPermalink which is nested under a .Pages or .RegularPages range. .Menus ranges should be left to .URL.

Thanks a lot to both you! It works fine now :slight_smile: