Page.Hugo is deprecated / Page.RSSLink is deprecated

This is a topic I’ve seen a couple of times in search, but couldn’t find something “dumbed down” enough for me to follow.

Two warnings:

WARN 2020/07/17 14:03:53 Page.Hugo is deprecated and will be removed in a future release. Use the global hugo function.
WARN 2020/07/17 14:03:53 Page.RSSLink is deprecated and will be removed in a future release. Use the Output Format’s link, e.g. something like:
{{ with .OutputFormats.Get “RSS” }}{{ .RelPermalink }}{{ end }}

I understand this could be related to my theme. I use Hyde, which is an old one. But I can’t find a reference to these lines anywhere so I can replace them and try to play with them. Site is hosted on GitHub: https://github.com/jarss/TAONAW so maybe someone can tell me what I need to look at to get this sorted out? Thanks!

Options:

1) Within your code editor, search for “.RSSLink” and “.Hugo”

2) With Linux/macOS use grep:

grep -r "\.RSSLink"
themes/hyde/layouts/partials/head.html: <link href="{{ .RSSLink }}" rel="alternate" type="application/rss+xml" title="{{ .Site.Title }}" />
layouts/partials/head.html: <link href="{{ .RSSLink }}" rel="alternate" type="application/rss+xml" title="{{ .Site.Title }}" />
grep -r "\.Hugo"
themes/hyde/layouts/partials/head.html: {{ .Hugo.Generator }}
layouts/partials/head.html: {{ .Hugo.Generator }}

Thank you.

So I see how you found it and I was able to fix the RSSLink issue by copying the code suggested here: https://gohugo.io/templates/rss/#the-embedded-rssxml. I hope it works, I’ll see once the site is live after the next update.

For the Hugo.Generator issue though, I’m still not sure what to do. What is the global hugo function this refers too? And if Page.Hugo is deprecated, I still don’t see .Hugo on it’s own, it’s connected to Generator… I’m not sure what that’s all about. Like I said, I have very basic knowledge of how the code works here. I don’t see the problem in describes for me to fix, if this makes sense.

edit so I just searched for “Hugo.Generator” and found this page: https://gohugo.io/variables/hugo/. I copied the example suggested there and it works. Why it works, I have no idea. Trying to wrap my head around this. I see it says “Page’s” Hugo which means this f unction is a sub-function (?) of Page.

Options:

1) Remove {{ .Hugo.Generator }}. It isn’t needed anymore. Unless you’ve set disableHugoGeneratorInject = true in your config.toml file, the following HTML will be injected into the <head> of your home page:

<meta name="generator" content="Hugo 0.74.2" />

2) Replace {{ .Hugo.Generator }} with {{ hugo.Generator }}.

1 Like

Thanks again. I just used option 2.
Again, I’d love to know why this works. I understand this is a support form and I just got my answer and it seems to be working.

I did watch the Hugo tutorials and vids 2 years ago. To understand this concept better, do you mind recommending where I should go to learn about it more? It will help in the future.

Thanks for being on top of this I’m marking this as resolved.

1 Like

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