Skip to content

Commit c188a3f

Browse files
authored
site: publish robots.txt with sitemap and content signals (#481)
The live robots.txt held only Cloudflare's content-signal preamble: no user-agent group and no Sitemap line. Add an origin robots.txt that allows all crawlers, states search=yes and ai-input=yes, and points at the sitemap index. ai-train is left unstated. The site check now fails if the built robots.txt loses the sitemap line.
1 parent 6b572d4 commit c188a3f

3 files changed

Lines changed: 9 additions & 0 deletions

File tree

‎site/public/robots.txt‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
User-agent: *
2+
Content-Signal: search=yes, ai-input=yes
3+
Allow: /
4+
5+
Sitemap: https://echo.labstack.com/sitemap-index.xml

‎site/scripts/check-site.mjs‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,9 @@ for (const locale of ['es', 'ja', 'pt-br', 'zh-cn']) {
9797
for (const path of ['sitemap-index.xml', 'pagefind/pagefind.js']) {
9898
if (!existsSync(join(distDir, path))) problems.push(`Missing ${path}`);
9999
}
100+
const robots = join(distDir, 'robots.txt');
101+
if (!existsSync(robots)) problems.push('Missing robots.txt');
102+
else if (!readFileSync(robots, 'utf8').includes('Sitemap: https://echo.labstack.com/sitemap-index.xml\n')) problems.push('robots.txt: missing sitemap');
100103
for (const path of ['llms.txt', 'next/llms.txt']) {
101104
const file = join(distDir, path);
102105
if (!existsSync(file)) { problems.push(`Missing ${path}`); continue; }

‎site/scripts/site-checks.test.mjs‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ test('new routes pass without accepting a baseline; removals and new-page broken
3232
for (const locale of ['es', 'ja', 'pt-br', 'zh-cn']) file(site, `dist/${locale}/middleware/index.html`, `<html lang="${locale}"></html>`);
3333
for (const path of ['sitemap-index.xml', 'pagefind/pagefind.js']) file(site, `dist/${path}`, '');
3434
for (const path of ['llms.txt', 'next/llms.txt']) file(site, `dist/${path}`, '# Echo\n');
35+
file(site, 'dist/robots.txt', 'Sitemap: https://echo.labstack.com/sitemap-index.xml\n');
3536
file(site, 'dist/new-page/index.html', '<html lang="en"><a href="/">Home</a></html>');
3637
const accepted = check(site, 'check-site.mjs');
3738
assert.equal(accepted.status, 0, accepted.stderr);

0 commit comments

Comments
 (0)