Skip to content

Commit 930740a

Browse files
authored
Switch to using hugo.IsProduction (#39763)
1 parent f545964 commit 930740a

File tree

4 files changed

+6
-7
lines changed

4 files changed

+6
-7
lines changed

site/layouts/_default/examples.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@
158158

159159
{{ .Content }}
160160

161-
{{- if eq hugo.Environment "production" -}}
161+
{{- if hugo.IsProduction -}}
162162
<script src="/docs/{{ .Site.Params.docs_version }}/dist/js/bootstrap.bundle.min.js" {{ printf "integrity=%q" .Site.Params.cdn.js_bundle_hash | safeHTMLAttr }}></script>
163163
{{- else -}}
164164
<script src="/docs/{{ .Site.Params.docs_version }}/dist/js/bootstrap.bundle.js"></script>

site/layouts/partials/scripts.html

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
{{ if eq hugo.Environment "production" -}}
1+
{{ if hugo.IsProduction -}}
22
<script src="/docs/{{ .Site.Params.docs_version }}/dist/js/bootstrap.bundle.min.js" {{ printf "integrity=%q" .Site.Params.cdn.js_bundle_hash | safeHTMLAttr }}></script>
33
{{ else -}}
44
<script src="/docs/{{ .Site.Params.docs_version }}/dist/js/bootstrap.bundle.js"></script>
@@ -15,7 +15,7 @@
1515
{{- $targetDocsJSPath := path.Join "/docs" .Site.Params.docs_version "assets/js/docs.js" -}}
1616
{{- $docsJs := append $js $vendor | resources.Concat $targetDocsJSPath -}}
1717

18-
{{- if eq hugo.Environment "production" -}}
18+
{{- if hugo.IsProduction -}}
1919
{{- $docsJs = $docsJs | resources.Minify -}}
2020
{{- end }}
2121

site/layouts/partials/stylesheet.html

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@docsearch/css@3">
22

3-
{{ if eq hugo.Environment "production" -}}
3+
{{ if hugo.IsProduction -}}
44
{{ if eq .Page.Params.direction "rtl" -}}
55
<link href="/docs/{{ .Site.Params.docs_version }}/dist/css/bootstrap.rtl.min.css" rel="stylesheet" {{ printf "integrity=%q" .Site.Params.cdn.css_rtl_hash | safeHTMLAttr }}>
66
{{- else -}}
@@ -15,7 +15,7 @@
1515
{{- $sassOptions := dict "targetPath" $targetDocsCssPath "outputStyle" "expanded" "precision" 6 -}}
1616
{{- $postcssOptions := dict "use" "autoprefixer" "noMap" true -}}
1717

18-
{{ if eq hugo.Environment "production" -}}
18+
{{ if hugo.IsProduction -}}
1919
{{- $sassOptions = merge $sassOptions (dict "outputStyle" "compressed") -}}
2020
{{- end -}}
2121

site/layouts/robots.txt

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
# www.robotstxt.org
22

3-
{{- $isProduction := eq hugo.Environment "production" -}}
43
{{- $isNetlify := eq (getenv "NETLIFY") "true" -}}
5-
{{- $allowCrawling := and (not $isNetlify) $isProduction -}}
4+
{{- $allowCrawling := and (not $isNetlify) hugo.IsProduction -}}
65

76
{{ if $allowCrawling }}
87
# Allow crawling of all content

0 commit comments

Comments
 (0)