Updated 2026-10-20
Add SEO meta tags on Netlify with a build plugin
On Netlify you don't need to touch your build command. The netlify-plugin-headlark Build Plugin runs Headlark on your publish directory after the build, with your site's main URL as the base for page URLs and canonicals.
1. Install
npm i -D netlify-plugin-headlark
2. Enable it
# netlify.toml
[[plugins]]
package = "netlify-plugin-headlark"
# optional: fail the build if a page can't be optimized
[plugins.inputs]
strict = true
3. Add your key
Site configuration → Environment variables → add HEADLARK_KEY with your site's secret key from the dashboard.
How it works
- It runs in Netlify's
onPostBuildstep on the publish directory, so it works with any framework that outputs HTML: Vite, Astro, Eleventy, Hugo, a Next.js static export. - Page URLs come from your site's main URL (
URLin Netlify's build environment). - Tags are written into the HTML, so Google, Bing and the link previewers of Slack, LinkedIn, Facebook and X all see them.
- Pages whose content hasn't changed come from cache on every later deploy, at no cost.
The Netlify docs list the plugin's options. To see what your live site is missing before you enable it, run the free site checker on it.
Already using a deploy notification?
A Netlify outgoing webhook (see the deploy hook docs) publishes SEO for the snippet, which only Google sees. If you can add a build plugin, prefer the plugin.
Try it
The free plan covers one site and 25 pages. Add your site, copy its secret key, and your next build ships with SEO.