This article is part of the series SEO Basics: Indexing.

TL;DR

  • introduce a new setting to your front-matter “index”
    • when set to true, the page should be indexed
  • use it in head template at layouts/partials/head/head.html to generate the according meta robots tag
{{- if .Params.index }}
<meta name = "robots" content = "index">
{{- else }}
<meta name = "robots" content = "noindex">
{{- end }}
  • if you are using a theme, copy their head.html and adjust it accordingly. Hugo will use your template when building for prod but a head.html partial usually contains more than just the meta robots tag

Further reading

“Robots” - Control what is indexed