Hugo: Show filenames and line numbers in deprecation warnings

Created on 13 Jul 2020  路  4Comments  路  Source: gohugoio/hugo

Per the "Page.URL is deprecated" warnings (related to #4117), I'm wondering if you'd consider including the filename and/or line number that is triggering the warning?

I'm new to Hugo, so please forgive my ignorance here. :) I'm helping a friend with a few small tasks for his Hugo-powered site, and have checked all the .URL instances I could find by doing a global search in VS Code. All appear to be menu- and navigation-related, not Page context.

I've tried the various tips in the forum posts that discuss the Page.URL deprecation, but none have worked. I've also looked through closed Issues and PRs here, in case this has been discussed already, but I didn't find this mentioned.

A few people have asked in the forum about filenames and line numbers, to help with debugging this:

Thanks in advance for considering, and I appreciate your work on Hugo and with its community!

Enhancement

Most helpful comment

So, adding the line-numbers etc. to the WARNING is very hard. But what we could do is to add a flag called --fail-on-deprecation or something that did a panic(msg)-- that would create the proper error message, I think.

All 4 comments

So, I agree, and this has been requested before, the problem is: I don't know how to do it in a simple way.

Maybe somebody have little ideas or plan how we can do this

So, adding the line-numbers etc. to the WARNING is very hard. But what we could do is to add a flag called --fail-on-deprecation or something that did a panic(msg)-- that would create the proper error message, I think.

That would work for us!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

crash-dive picture crash-dive  路  3Comments

geddski picture geddski  路  3Comments

ianbrandt picture ianbrandt  路  3Comments

chrissparksnj picture chrissparksnj  路  3Comments

antifuchs picture antifuchs  路  3Comments