From bf79c208aeb506c195d0ce3728d343e52b75e3f3 Mon Sep 17 00:00:00 2001 From: Aditya Telange <21258296+adityatelange@users.noreply.github.com> Date: Sun, 13 Dec 2020 20:19:25 +0530 Subject: [PATCH] layouts: use hugo.IsProduction --- layouts/partials/cover.html | 2 +- layouts/partials/head.html | 4 ++-- layouts/robots.txt | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/layouts/partials/cover.html b/layouts/partials/cover.html index d44581b5..86ee4894 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)) }} -{{- if eq (getenv "HUGO_ENV") "production" | or (eq .Site.Params.env "production") }} +{{- if hugo.IsProduction | or (eq .Site.Params.env "production") }} {{- else }} @@ -76,7 +76,7 @@ {{ end }} {{- partial "extend_head.html" . -}} -{{- 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 35f59d15..da3e7e0d 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: /