All guides

Install Foresite on Hugo

Hugo builds every page's <head> from your theme, so the line goes into the theme's head template without editing the theme itself:

  1. If your theme has a hook for extra head code, use it. Many do, for example layouts/partials/extend_head.html in PaperMod. Your theme's README names it. Create that file in your own site's layouts folder and paste your Foresite line into it.
  2. Otherwise, override the theme's head template. Find the file that holds </head> under themes/YOUR_THEME/layouts/, copy it to the same path under your site's own layouts/ folder, and paste your Foresite line just before </head>. Hugo uses your copy instead of the theme's, so theme updates won't remove the line.
  3. Rebuild and deploy.

Visits to localhost aren't counted, so hugo server won't add test traffic. After you deploy, the Installation Check in Settings → Install turns green with the first pageview.