How to Write the Public Dashboard URL in Plausible-Hugo

Plausible-Hugo writes the public dashboard URL as an HTML comment only when public_dashboard is enabled in your site configuration, using the partial layouts/partials/plausible_head_public_url.html to concatenate your page domain with your Plausible domain.

The divinerites/plausible-hugo module streamlines analytics integration for Hugo static sites. When you need to expose your analytics publicly, understanding how the public dashboard URL is written into your site's HTML ensures you can verify the configuration and troubleshoot visibility issues.

Where the Public Dashboard URL Logic Lives

The generation logic resides in layouts/partials/plausible_head_public_url.html. This partial evaluates whether site.Params.plausible.public_dashboard is set to true before writing any output.

When the flag is enabled, the partial constructs the URL using two parameters:

  • .Domain – the domain of the current page, supplied automatically by Hugo's page context.
  • site.Params.plausible.domain – your registered Plausible domain (e.g., example.com).

How the Public Dashboard URL Is Constructed

The partial concatenates these values to form the complete public dashboard path. It prefixes the result with https:// and outputs the result as an HTML comment.

The resulting format is:

<!-- Plausible Analytics public dashboard URL : https://<page-domain>/<plausible-domain> -->

This comment appears in your generated HTML source but does not render visually on the page. It serves as a metadata marker for debugging and verification purposes.

Configuring the Public Dashboard URL in config.toml

To enable this output, add the following to your config.toml:

[params.plausible]
  domain           = "your-plausible-domain.com"
  public_dashboard = true

If public_dashboard is omitted or set to false, the partial renders nothing, keeping your HTML output clean.

Distinguishing the Public URL Comment from the Dashboard Embed

It is important to note that the HTML comment generated by plausible_head_public_url.html is purely informational. The actual embedded dashboard that visitors can view is handled by a separate partial: layouts/partials/plausible_dashboard.html.

This embed partial requires a different configuration parameter:

[params.plausible]
  dash_link = "https://plausible.io/share/xxxx"

The embed partial constructs an iframe using this shared link, while the public URL comment simply documents the theoretical dashboard location.

Summary

  • The public dashboard URL is written as an HTML comment by layouts/partials/plausible_head_public_url.html.
  • Output only occurs when site.Params.plausible.public_dashboard is set to true.
  • The URL combines the current page domain with your configured Plausible domain.
  • This comment is distinct from the functional dashboard embed, which uses dash_link and plausible_dashboard.html.

Frequently Asked Questions

What happens if I enable public_dashboard but don't see the comment?

Verify that site.Params.plausible.domain is set correctly in your config.toml. The partial checks for both the public_dashboard flag and a valid domain parameter before rendering the comment. If either is missing, the output remains empty.

Can visitors see the public dashboard without the embed partial?

No. The HTML comment generated by plausible_head_public_url.html is invisible to visitors and only appears in the page source. To display the actual dashboard, you must use the plausible_dashboard.html partial with a valid dash_link parameter configured.

Why does the URL format use https:///?

This structure reflects Plausible Analytics' public dashboard URL convention, where your site domain precedes your Plausible account domain in the path. The partial constructs this automatically to match Plausible's expected routing format for public stats access.

Is the public_dashboard flag required for the embed to work?

No. The dashboard embed functionality operates independently using the dash_link parameter. You can embed a shared dashboard without enabling public_dashboard, and conversely, you can enable the public URL comment without embedding the dashboard iframe.

Have a question about this repo?

These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:

Share the following with your agent to get started:
curl -s "https://instagit.com/install.md"

Works with
Claude Codex Cursor VS Code OpenClaw Any MCP Client

Maintain an open-source project? Get it listed too →