The deprecation warning poped for the commented code

Now I am using hugo of version 0.55.3. It shows the .url warning when I build my site like:

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. 

I checked my code and find this is caused by the line of a variable claim.

{{ $url := .URL }}

I find the warning does not appear anymore if I delete it. However, if I comment it with the <!-- ... --> , the warning pops again. So shall we make some modification so that the warning could work better?

1 Like

The above is a HTML comment. Go templates need a different type of comment i.e.
{{/* <--- everything in between here will be ignored ---> */}}

Have a look at the Docs:

The warning is fine…

1 Like