layouts: use hugo.IsProduction

This commit is contained in:
Aditya Telange 2020-12-13 20:19:25 +05:30
parent 153740bbac
commit bf79c208ae
No known key found for this signature in database
GPG Key ID: 82E844EF3DA99E77
3 changed files with 4 additions and 4 deletions

View File

@ -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) -}}

View File

@ -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" . }}

View File

@ -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: /