I wanted to render the hugo navigation differently on my development (internal) server and my production (public) server. This is how I did it for partials…
Hugo has a couple of settings we can check
{{ hugo.Environment }} returns "development" or "production"
{{ hugo.IsProduction }} returns true or false
{{ if hugo.IsProduction }}
I render when in production
{{ end }}
{{ if not hugo.IsProduction }}
I render when not in production
{{ end }}
Use the –environment flag when starting hugo
Production Deployment script
hugo --environment development ...
Development docker compose file
hugo --environment development ...