Skip to content

Robots

Static Robots File

To create a static robots.txt file you simply need to create the robots.txt inside your /public/ directory (or equivelant).

You then need to configure Altitude to recognise the file exists during the deployment informing Altitude of your framework’s build output.

This is your public folder is located after your framework has completed a npm run build.

altitude.yaml
version: v2.0
provider: cloudflare
routes:
- pathPrefix: /
name: ssr
type: function
directory: .
build:
command: build
output:
directory: dist
filename: _worker.js
staticDirectory: ssr-assets

Dynamic Robots File

Robots.txt files can also be dynamically generated. This can be useful for a multi-tenanted codebase and changing which robot.txt is served to which tenant.

Refer to the specific framework guides on how to set these up: