Development without CDN assets, production with CDN assets

We need to self-host most URLs on a domain, but compliance is cool with us using a pull CDN for some kids of /assets/. I see I can do that by prefixing those sources in the theme as “//{{.Params.image}}” or something like that, so that’s no problem, but it leaves a small problem in that editorial will see broken new assets while editing before they’re in prod and reachable by the CDN.

I can think of some kludgy ways around that, but there doesn’t seem to be anything as straightforward as a hugo -D for certain theme tweaks—or is there? Can anyone recommend a good approach for modifying a subset of URLs between development and production?

{{ if eq hugo.Environment "development" -}}
  do stuff…
{{ else -}}
  do other stuff…
{{ end -}}
1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.