diff options
| author | Aditya Telange <21258296+adityatelange@users.noreply.github.com> | 2020-12-13 20:19:25 +0530 |
|---|---|---|
| committer | Aditya Telange <21258296+adityatelange@users.noreply.github.com> | 2020-12-13 20:19:25 +0530 |
| commit | bf79c208aeb506c195d0ce3728d343e52b75e3f3 (patch) | |
| tree | cb5969dd3daa630c263e17cf5514e861855d5347 | |
| parent | 153740bbac3ce4f7a23369bed66112f6852b6af4 (diff) | |
layouts: use hugo.IsProduction
| -rw-r--r-- | layouts/partials/cover.html | 2 | ||||
| -rw-r--r-- | layouts/partials/head.html | 4 | ||||
| -rw-r--r-- | layouts/robots.txt | 2 |
3 files changed, 4 insertions, 4 deletions
diff --git a/layouts/partials/cover.html b/layouts/partials/cover.html index d44581b..86ee489 100644 --- a/layouts/partials/cover.html +++ b/layouts/partials/cover.html @@ -9,7 +9,7 @@ rel="noopener noreferrer">{{ end -}} {{- $sizes := (slice "360" "480" "720" "1080" "1500") }} {{- $processableFormats := (slice "jpg" "jpeg" "png" "tif" "bmp" "gif") }} - {{- $prod := (eq (getenv "HUGO_ENV") "production" | or (eq .Site.Params.env "production")) }} + {{- $prod := (hugo.IsProduction | or (eq .Site.Params.env "production")) }} {{- if (and (in $processableFormats $cover.MediaType.SubType) (ne .Site.Params.cover.responsiveImages false) (eq $prod true)) }} <img srcset="{{- range $size := $sizes -}} {{- if (ge $cover.Width $size) -}} diff --git a/layouts/partials/head.html b/layouts/partials/head.html index 408cee0..f257b68 100644 --- a/layouts/partials/head.html +++ b/layouts/partials/head.html @@ -1,7 +1,7 @@ <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> -{{- if eq (getenv "HUGO_ENV") "production" | or (eq .Site.Params.env "production") }} +{{- if hugo.IsProduction | or (eq .Site.Params.env "production") }} <meta name="robots" content="index, follow"> {{- else }} <meta name=" robots" content="noindex, nofollow"> @@ -76,7 +76,7 @@ {{ end }} {{- partial "extend_head.html" . -}} <!-- Misc --> -{{- if eq (getenv "HUGO_ENV") "production" | or (eq .Site.Params.env "production") }} +{{- if hugo.IsProduction | or (eq .Site.Params.env "production") }} {{- template "_internal/google_analytics_async.html" . }} {{- template "_internal/google_news.html" . }} {{- template "partials/templates/opengraph.html" . }} diff --git a/layouts/robots.txt b/layouts/robots.txt index 35f59d1..da3e7e0 100644 --- a/layouts/robots.txt +++ b/layouts/robots.txt @@ -1,5 +1,5 @@ User-agent: * -{{- if eq (getenv "HUGO_ENV") "production" | or (eq .Site.Params.env "production") }} +{{- if hugo.IsProduction | or (eq .Site.Params.env "production") }} Disallow: {{- else }} Disallow: / |
