Everything a developer changes on a Core dna site lives in its theme repository. This guide covers the repository and its build, printing records in templates, stylesheets and client-side code, and the parts of a site around the main content.
L1–L2
Unit 05 · Around the main content
Robots and the sitemap
Around the main contentPage 34 of 35Updated
What a theme repo's robots.txt is, how each record's robots setting becomes a meta tag, how the platform builds /sitemap.xml, and which settings and records decide what it lists.
Who this is for. Developers preparing a site for search engines at launch. After this page you can ship the right robots.txt, print each record's robots setting as a meta tag, and decide which content the sitemap lists.
robots.txt
/robots.txt is not a platform route. It is a plain file at the root of the theme repo, served as it is like any other static file. Because it is a file, it is the same on every hostname and environment that serves the repo: keep staging copies out of search results with a noindex meta tag (Markup that differs by environment), not with the file.
A live site that allows crawling, with the address of its sitemap:
A theme repo built before launch often carries Disallow: / to keep an unfinished site out of search results. Check the file in the release that goes live.
The robots setting on each record
Every versioned record (page, blog post, book page, FAQ page and question, product and category description) has SEO settings, which a template reads with getSeoSettings(). Their robots select stores one of these keys, which getRobots() returns:
Key
Label in the admin
Directive to print
(empty)
Default (recommended)
No tag
all
Index & follow
index, follow
index
Index, but don't follow
index, nofollow
follow
Don't index, but follow
noindex, follow
none
Don't index and don't follow
noindex, nofollow
Map each key to the directive its label describes, and let the environment check from Markup that differs by environment take precedence off production:
/sitemap.xml is a platform route; a theme repo does not write it. The platform builds the sitemap in the background and serves the built file:
A built sitemap is served for up to an hour. After that, the next request starts a fresh build.
An hourly task rebuilds the sitemap of each site's primary environment, so the live sitemap stays current on its own.
On any other environment, such as staging, the sitemap is rebuilt when /sitemap.xml is requested and the built copy is more than an hour old. To check a staging sitemap, request it, then request it again once the build has run.
What the sitemap lists
Each content module has a setting, named generateInSitemap in every module, that decides whether its records are listed:
Module
Records
Default
Pages
Pages
On
Blogs
Blogs and posts, one setting each
On
FAQ
FAQ pages and questions, one setting each
On
Products
Products
On
Books
Books, units and pages, one setting each ("Generate books in sitemap", "Generate units in sitemap" and "Generate pages in sitemap")
Off
Book content is listed once the three Books settings are turned on. Whatever the module setting, a record is left out when:
its robots setting is follow ("Don't index, but follow") or none ("Don't index and don't follow");
it has no path;
its canonical URL points to another site.
So the sitemap and the meta tag agree: a record an editor marks "Don't index" is neither listed nor offered for indexing.
At go-live
Check that the released robots.txt allows crawling, turn on the Books sitemap settings if book content should be found, and request /sitemap.xml on the live hostname to see what it lists.