Hugo sets meta name="generator" at first position in the head tag

<head>
    <meta name="generator" content="Hugo 0.112.7">
    <meta charset="utf-8">

Hugo sets meta name=“generator” at first position in the head tag

  • how to keep <meta charset="utf-8"> at first position in head?

This is set in theme that you using.

Hugo do not inject this on its own.

Search for this string in your theme and move accordingly

{{ hugo.Generator }}

I cannot find Generator in the code from portio-hugo

How you loading your theme, locally or as a module. If as a module, search through theme in theme repo directly.

I load it locally not as a module

Ok, share your repository

Hugo will by default add the meta tag to your <head> if you don’t set it yourself. In this case, the position is not configurable.

If you set the meta tag yourself, you have the full control to position it behind your meta-charset tag.

Eg. replace your lines with this:

  <head>
    <meta charset="utf-8">
    {{ hugo.Generator }}
2 Likes

Is this the theme you are using?

If so, add this to your configuration file at the top level after the title entry. Configure Hugo | Hugo

disableHugoGeneratorInject = true

If you still want to show the Hugo version in use add this code before the closing </head> tag in your theme’s head.html file.

{{- if .IsHome }}
{{- hugo.Generator }}
{{- end }}
4 Likes

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