Make only live website indexable

This change updates how we run Hugo AND changes the logic for checking
whether a page should be indexable (copied with a backport from upstream
Docsy).
This commit is contained in:
Tim Bannister
2021-12-07 14:16:55 +00:00
parent 37e625e28c
commit 20e4c39f2e
4 changed files with 24 additions and 28 deletions
+1 -1
View File
@@ -1,4 +1,4 @@
{{- if eq (getenv "HUGO_ENV") "production" }}
{{- if eq hugo.Environment "production" }}
{{- $cssFilesFromConfig := site.Params.pushAssets.css -}}
{{- $jsFilesFromConfig := site.Params.pushAssets.js -}}
{{- $pages := site.RegularPages -}}
+7 -6
View File
@@ -1,5 +1,11 @@
{{- $isBlogPost := eq .Section "blog" }}
{{- $ogType := cond (.IsHome) "website" "article" }}
<!-- per-page robot indexing controls -->
{{- if hugo.IsProduction -}}
<meta name="ROBOTS" content="INDEX, FOLLOW">
{{- else -}}
<meta name="ROBOTS" content="NOINDEX, NOFOLLOW">
{{- end -}}
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-36037335-10"></script>
<script>
@@ -19,11 +25,6 @@
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
{{ hugo.Generator }}
{{ if eq (getenv "HUGO_ENV") "production" }}
<META NAME="ROBOTS" CONTENT="INDEX, FOLLOW">
{{ else }}
<META NAME="ROBOTS" CONTENT="NOINDEX, NOFOLLOW">
{{ end }}
{{ range .AlternativeOutputFormats -}}
<link rel="{{ .Rel }}" type="{{ .MediaType.Type }}" href="{{ .Permalink | safeURL }}">
{{ end -}}
@@ -33,7 +34,7 @@
{{- template "_internal/google_news.html" . -}}
{{- template "_internal/schema.html" . -}}
{{- template "_internal/twitter_cards.html" . -}}
{{ if eq (getenv "HUGO_ENV") "production" }}
{{- if hugo.IsProduction -}}
{{ template "_internal/google_analytics_async.html" . }}
{{ end }}
{{ partialCached "head-css.html" . "asdf" }}