.URL Deprecated?

Hi all,

Been seeing a warning that is now an error stating “.URL” has been depreciated. This seems very, very strange since .URL still appears in official Hugo documentation, and it’s the thing that drives my navigation menus (especially showing “active” menu items"). The suggestions of “RelPermalink” and “Permalink” don’t function for baseline, top-band navigation despite how the frontmatter is configured.

Seeing as how this feature is disappearing soon, what is the recommended fix?

The warning actually tells you what to exchange with what in most cases. Also, not .URL is deprecated, but, I think, .Page.URL? The proper parameter for the permalink of a page is .Page.Permalink.

Show your template that is using this (update to 0.92.0 and run Hugo with --panicOnWarning to see where it is used).

Hey Patrick,

Thanks for your reply, and apologies for the delay getting back to you.

Running Hugo with --panicOnWarning doesn’t show me anything at all. I am reusing code between projects, and it’s this one that keeps giving me the warning where others don’t. I’m only leveraging .URL for the navigation, so I’m left wondering if there’s documentation about these depreciated commands that haven’t been clearly communictated.

Anyone else? Seems strange this has sat for three days with a single reply…

If this is about the .Page.URL deprecation, that happened about 3 years back:

If you search this forum for a similar error, you’ll find posts like yours all the way back from 2019.

If you can share your repo, someone can help you fix the warning.

1 Like

Hey -

Thanks for your reply. The repro is private by proxy of my contract, and I don’t presently have bandwidth to put anyone on this forum under an NDA.

If --panicOnWarning, grep search, and similar fail to produce where this line of code appears, what steps can I take to find where this line of code might be?

If you cannot share the repo then please share a project with dummy content that replicates the problem.

We cannot help from vague descriptions.

This forum has Requesting Help guidelines that have to be followed when opening a support topic.

Hey @alexandros,

I appreciate your response, though if you read the initial post the ask isn’t really that vague. To reiterate - Documentation is lacking, and while I have looked at historic posts around what exactly is depreciated around .URL the answers are largely a constellation of opinions.

  • .URL still appears in official Hugo documentation, which begs the question which piece of it is being depreciated and where.

  • There is one post in many that states context is what’s most important, and the stated exceptions are top-level navigation, sidebar navigation, as well as pagination. The post says that .URL should not appear in a page context. Having seen little else away from that post, I was more or less asking for clarification around which elements of .URL will lose support in Hugo .93.

  • To piggyback on my second bullet, if the notion of context is purely page context (excepting navigation and pagination) I’m left trying to understand one of two things - Hugo now expects partials to have a specific naming convention so as to escape similar warnings, or naming does not matter and the Hugo developers would like to see a global change in the way navigation and pagination is handled throughout the framework. It would be helpful if there was something in the docs to make this bit concrete.

If anything, there is a fair failure in actionable clarity around the documentation and what the warning portends. As a previous respondent mentioned, this is a question that’s been open for at least three years; my research shows an absence of firm documentation from the Hugo team about the change they’re hoping to achieve. That should tell us that the warning and potential fixes have not been documented in a clear, equitable way.

Given that I cannot find Page.URL anywhere in my source, should I expect that top-level navigation and Pagination will fail if I continue to use .URL (which is still suggested in current Hugo documentation) once 0.93 is released?

@kaushalmodi,

Appreciate this, though I am leveraging .URL specifically in pagination and navigation menus. I am not using it in a page context. It’s my understanding that .URL is still usable in the before mentioned contexts, which is what is creating a lot of confusion around the error and available documentation.

Is .URL losing support on launch of Hugo 0.93 globally, or are navigation menus and pagination still supported? The ask is due to previous forum posts and answers that seem to portend navigations menus and pagination will still function with .URL.

Page.URL is not being leveraged at all in any of the sites I have designed and launched in Hugo. If this is the only piece going the way of the dodo, this is what needs to appear in official documentation.

@adsoink

I have read the initial post. Please do not assume otherwise.

Page.URL has been deprecated for a number of years.
And I really don’t know what out-of-date theme you’re using or what outdated tutorial you followed and you run into this issue.

Users should instead use .Permalink or .RelPermalink to reference their .Pages.
The documentation is perfectly clear on that.
If you feel you can improve it then you can always contribute to make it better.

.URL in Hugo Menus and Pagination is not deprecated, as you mention.

Regarding your comment about “partial naming conventions” I have no idea what you’re talking about and I think that you need to open another topic.

However please note that I asked you to follow the Forum Guidelines and requested a sample repo that reproduces the problem.

You have not provided that.

Instead you are opening a discussion that in my honest opinion does not contribute to the issue at hand.

This a support forum for concrete questions that sometimes need to be accompanied by code to solve them.

Therefore I am closing this topic.

If you feel like sharing a sample repo that reproduces the issue you are talking about then feel free to open another topic.

Furthermore please do not tag me again, as currently my time is very limited.

EDIT

For the record with commit 7f3d5c the .Page.URL methods are going to be removed in the next Hugo release.