Build step

Add one command after your framework's build. It reads every .html file in the output folder, sends it to Headlark with your secret key and rewrites the <head> in place, before your host uploads it.

npm i -D headlark
// package.json
"scripts": {
  "build": "vite build && headlark dist --site-url https://example.com"
}

Set HEADLARK_KEY to your site's secret key in the build environment (Vercel: Project → Settings → Environment Variables; Netlify: Site configuration → Environment variables; GitHub Actions: a repository secret).

Step-by-step setups: Astro, Next.js static export, Vercel, GitHub Pages.

Options

Safe by default

Good to know