Back to Integrations

Hugo Integration

Add the Pulse script via a Hugo partial or directly in your base template.


Method 1: Create a partial

Create an analytics partial with a production guard using Hugo's .Site.IsServer flag.

layouts/partials/analytics.html
{{ if not .Site.IsServer }}
<script
  defer
  data-domain="your-site.com"
  src="https://pulse.ciphera.net/script.js"
></script>
{{ end }}

Method 2: Include the partial in your base layout

Add the partial to your baseof.html layout.

layouts/_default/baseof.html
<!DOCTYPE html>
<html lang="{{ .Site.Language }}">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    {{ partial "analytics.html" . }}
    <title>{{ .Title }}</title>
</head>
<body>
    {{ block "main" . }}{{ end }}
</body>
</html>

For more details, see the Hugo partials docs.

Related Integrations: Jekyll, Eleventy, Astro