Subsections of 2026

Hugo - Skip rendering certain elements on Local Server

Hugo IsServer Hugo IsServer

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.

{{ if not hugo.IsServer }}
    <!-- This is rendered only on Production Build  -->
{{ end }}