mirror of
https://github.com/hugo-fixit/FixIt.git
synced 2026-08-24 07:18:57 +00:00
22 lines
781 B
HTML
22 lines
781 B
HTML
{{- /*
|
|
A shortcode to conditionally render content based on the current Hugo environment.
|
|
Hugo environments (development, production, etc.) usage reference:
|
|
- https://gohugo.io/functions/hugo/environment/
|
|
- https://gohugo.io/configuration/all/#environment
|
|
|
|
For example, to render content only in the "production" environment:
|
|
{{< env "production" >}}
|
|
This content is only visible in production.
|
|
{{< /env >}}
|
|
*/ -}}
|
|
|
|
{{- $env := .Get 0 -}}
|
|
{{- if eq $env hugo.Environment -}}
|
|
{{- .Inner | .Page.RenderString -}}
|
|
{{- else if hugo.IsServer -}}
|
|
<details>
|
|
<summary>[Hugo Server]: Click to expand <strong><code>{{ $env }}</code></strong> environment content.</summary>
|
|
<pre><code>{{- printf `%s` "\n" | trim .Inner -}}</code></pre>
|
|
</details>
|
|
{{- end -}}
|