2026
Hugo - Skip rendering certain elements on Local Server
Use hugo.IsServer to conditionally exclude integrations like analytics or comments from rendering on the local server. {class=“children children-type-flat children-sort-”}
Hugo - Skip rendering certain elements on Local Server
Use hugo.IsServer to conditionally exclude integrations like analytics or comments from rendering on the local server. {class=“children children-type-flat children-sort-”}
With time, you will start to have more things integrated in the blog. For example, your analytics scripts or commenting scripts. While it might be ok include scripts for such integrations while setting them up, after you have done that, you might not want to include them locally, just to avoid additional calls and getting distracted, while you write.
A simple way to exclude such things to be excluded from rendering process on Local Server is by the use of conditionals with hugo.IsServer. Something like this.