Troy Lindsay e09ebe11eb
Update build env logic (#453)
* Adds GetEnvironmentName and IsProduction partial functions, which
  improve DRY
* Add prioritization for determining environment name, which favors the
  existing methods: the `HUGO_ENV` environment variable and site config
  `env` theme parameter
* Adds `useHugoEnv` theme parameter to use the value of
  `.Hugo.Environment` for the build environment name
2022-01-03 13:13:12 -06:00

53 lines
2.2 KiB
HTML
Executable File

{{ $env := partial "func/GetEnvironmentName.html" . }}
{{ $isProduction := partial "func/IsProduction.html" . }}
<!DOCTYPE html>
<html lang="{{ $.Site.LanguageCode | default "en" }}">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
{{/* NOTE: the Site's title, and if there is a page title, that is set too */}}
<title>{{ block "title" . }}{{ with .Params.Title }}{{ . }} | {{ end }}{{ .Site.Title }}{{ end }}</title>
<meta name="viewport" content="width=device-width,minimum-scale=1">
<meta name="description" content="{{ with .Description }}{{ . }}{{ else }}{{if .IsPage}}{{ .Summary }}{{ else }}{{ with .Site.Params.description }}{{ . }}{{ end }}{{ end }}{{ end }}">
{{ hugo.Generator }}
{{ if $isProduction }}
<META NAME="ROBOTS" CONTENT="INDEX, FOLLOW">
{{ else }}
<META NAME="ROBOTS" CONTENT="NOINDEX, NOFOLLOW">
{{ end }}
{{ partial "site-style.html" . }}
{{ partial "site-scripts.html" . }}
{{ block "favicon" . }}
{{ partialCached "site-favicon.html" . }}
{{ end }}
{{ if .OutputFormats.Get "RSS" }}
{{ with .OutputFormats.Get "RSS" }}
<link href="{{ .RelPermalink }}" rel="alternate" type="application/rss+xml" title="{{ $.Site.Title }}" />
<link href="{{ .RelPermalink }}" rel="feed" type="application/rss+xml" title="{{ $.Site.Title }}" />
{{ end }}
{{ end }}
{{/* NOTE: These Hugo Internal Templates can be found starting at https://github.com/gohugoio/hugo/tree/master/tpl/tplimpl/embedded/templates */}}
{{- template "_internal/opengraph.html" . -}}
{{- template "_internal/schema.html" . -}}
{{- template "_internal/twitter_cards.html" . -}}
{{ if $isProduction }}
{{ template "_internal/google_analytics_async.html" . }}
{{ end }}
{{ block "head" . }}{{ partial "head-additions.html" . }}{{ end }}
</head>
<body class="ma0 {{ $.Param "body_classes" | default "avenir bg-near-white"}}{{ with $env }} {{ . }}{{ end }}">
{{ block "header" . }}{{ partial "site-header.html" .}}{{ end }}
<main class="pb7" role="main">
{{ block "main" . }}{{ end }}
</main>
{{ block "footer" . }}{{ partialCached "site-footer.html" . }}{{ end }}
</body>
</html>