Skip to Content
Documentation

SEO

Indexing

Let search engines index a production VitNode site and keep preview deployments out of search results with seo.indexing, X-Robots-Tag and noindex.

seo.indexing decides whether search engines may index a whole deployment. It defaults to true, so set it to false on previews and staging, and a test site never shows up next to the real one in search results.

This guide assumes SEO is set up.

What each value does

indexingPagesSitemap
trueIndexable, each page keeps its own robots tag/sitemap.xml and a Sitemap: line
falseX-Robots-Tag: noindex on every HTML response404, no Sitemap: line

With indexing: false the pages stay crawlable on purpose. A search engine has to fetch a page to read its noindex, so blocking it in robots.txt would hide the very signal that removes it. /robots.txt keeps the same rules and only loses the Sitemap: line.

indexing: false also hides the sitemap, whatever sitemap.enabled says. A sitemap invites crawlers to index what it lists, so the two cannot disagree.

Pick the value per deployment

indexing defaults to true, so check VITNODE_WEB_URL (or any host-provided environment variable) to turn it off outside production:

src/vitnode.server.config.ts
const PRODUCTION_ORIGIN = 'https://example.com'

seo: {
  indexing: process.env.VITNODE_WEB_URL === PRODUCTION_ORIGIN,
},
DeploymentVITNODE_WEB_URLResult
Productionhttps://example.comIndexable pages, /sitemap.xml, Sitemap: in robots.txt
Previewhttps://preview.example.comX-Robots-Tag: noindex on every page, sitemap 404

Any boolean expression works - VitNode reads the value you pass, not an environment variable of its own.

Set it for the build and the server

Prerendered pages are written at build time and served as files, without the server. When indexing is false during the build, VitNode writes <meta name="robots" content="noindex"/> into each of them; the server adds X-Robots-Tag: noindex to everything it renders. Give the build and the running server the same value, or the two kinds of page will disagree.

Page-level robots still apply

indexing: false keeps a page's own robots tag. A page that already sends noindex, nofollow keeps it. With indexing: true, a page can still opt out: set robots in its page metadata, or set a Content Engine record's noIndexField.

Check the result

On a preview deployment, look at the headers and HTML of any page:

curl -sI https://preview.example.com/ | grep -i x-robots-tag
curl -s https://preview.example.com/ | grep -o '<meta name="robots" content="noindex"/>'

The first line shows x-robots-tag: noindex for a server-rendered page. The second matches only on a prerendered page, which a host serves as a file without the header. /sitemap.xml answers 404.

Switching a live site from false to true takes effect with the next deployment. Search engines then need days to weeks to recrawl and reprocess pages, and removing a page from results is not instant either.