How is index.html content generated? (meta header for robots)

Hey all!

I am currently looking in the aspects relevant to SEO for my site. Primarily, I am trying to ensure the right crawling instructions are in place.

I have a multilingial site with de and en languages.

I have defined the page header in themes/mytheme/layouts/_default/baseof.html, where the meta header for robots i defined as follows:

{{ if $production }}
    <meta name="robots" content="index, follow">
{{ else }}
    <meta name="robots" content="noindex, nofollow">
{{ end }}

When building the site, an index.html is generated in the root folder, as well as in both language folders.

. index.html
|-- de/index.html
|-- en/index.html

The index.html files in the language folders show the meta header as expected:

<meta name="robots" content="index, follow">

In the index.html file in the root folder, however, I see the following content:

<!DOCTYPE html>
<html lang="de-DE">
    <link rel="canonical" href="">
    <meta name="robots" content="noindex">
    <meta charset="utf-8">
    <meta http-equiv="refresh" content="0; url=">

My questions:

  1. Where is the template for this page defined? Is this an internal template Hugo is using?
  2. Is this actually the correct way of going about things as this is effectively a redirection page to my default languages index page, which should not be indexed. Is it safe to assume that the “noindex” clause only applies to the root index.html and the header as shown above on the language-specific index.html pages will come into effect once the canonical link has been followed?
  3. If not, how can I adjust/override this template?

You can overwrite this template with your own implementation in layouts/alias.html. The default implementation is baked into Hugo and can be found in Hugos sourcecode repo.

Keep in mind that this layout will also be used if you define alias settings in your pages frontmatter.