robots.txt
Publish a robots.txt file that allows documentation indexing and points crawlers to the sitemap.
Loading documentation…
This is already configured in projects created with create-heyo-docs. No action is required if you used the creator to install Heyo Docs.
robots.txt tells crawlers that the public documentation may be indexed while
keeping Heyo Docs' internal Markdown resource route out of search results. A
new Heyo Docs project already serves this file at /robots.txt.
Set siteUrl to the canonical production address. Heyo Docs uses it for the
absolute sitemap URL in the generated response and falls back to the incoming
request origin when it is not set.
The response has the following shape:
robots.txt is advisory, not access control. Keep private content out of the
published documentation directory and protect private application routes
separately.
The response is the same in every framework, but the route convention is not. Add the implementation for your framework before the documentation catch-all route.
Register the resource route in app/routes.ts:
Then create app/routes/robots.ts:
For a static React Router deployment, also retain /robots.txt in the array
returned by prerender() in react-router.config.ts.
Create src/pages/robots.txt.ts:
Astro maps this file to /robots.txt and emits it during a static build.
Create app/robots.txt/route.ts:
config is the same Heyo Docs configuration used to build the documentation
model. Import it directly from heyo-docs.config.ts instead if the project
does not have the starter's app/lib/docs.ts helper.