With disableHugoGeneratorInject = true
set , I tried to add hugo.Generator
manually before the closing </head>
tag but it is blank. What could be the issue? I tried on both a test site and main site. Using recent version of Hugo.
Are you trying to move the location of the generator? I believe it is automatically injected to the home page, and not present in sub pages of the builds. At least when it’s not present in the config / set to default/false.
Do you have a link to the repo?
Yes.
I am checking the homepage.
I don’t use repos now since Cloudflare pages introduced direct uploads. But any test site should do. This issue seems to be a recent one.
Don’t turn it off. If it’s turned-off, it affects {{ hugo.Generator }}
as well.
You can use {{ hugo.Generator }}
anywhere you want. If I understood it correctly, the auto-injection will automatically use {{ hugo.Generator }}
if present, instead of the default location of the auto-injection.
At least that’s how I do it, the generator meta is moved around depending on where I placed {{ hugo.Generator }}
code.
Also, if you use {{ hugo.Generator }}
as-is, the generator meta will also appear in all your pages. You can use .IsHome
if you want it to appear on the homepage only.
It’s very hard to help or give feedback without a way to see the source code or have physical examples, but I believe @techmagus covered the basis for the behavior.
@techmagus I tried without disabling and with disabling and it does not work. I also limited it to homepage and it didn’t work either. Here’s a test theme I ported from Jekyll to Hugo for testing cc @willduncanphoto .
The generator code is in the head partial. Tested with Hugo v101
.
Change:
<meta name="generator" content="{{ hugo.Generator }}" />
To:
{{ hugo.Generator }}
PS
You have two <html>
element in your baseof.html
file.
Thanks for pointing that out! It was a learning process porting the theme over I might have missed that. Luckily, I don’t use it in production yet.
This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.