Hugo Content Management Series

Want a script to only run on Production? I don’t recommend this, as that can make it difficult for testing functionality locally

1
2
3
4
5
{{ if in (.Site.BaseURL | string) "www.example.com" }}
<script>
    // ... script / code goes here 
</script>
{{ end }}
Tags: Scripts, Production, Development

Read more from my blog for an introduction and quick tips on developing in Hugo or UCTD.

Meet the author

Photo for Damien Saunders
Damien Saunders
An experienced management consultant and business leader interested in digital transformation, product centred design and scaled agile. If I'm not writing about living with UCTD (an autoimmune disease), I'm probably listening to music, reading a book or learning more about wine.