October CMS resources and help articles

Simple and to the point. Optimized by the community.

Dynamic robots.txt

by Samuell, last modified on March 7th, 2020

This will allow to create dynamic robot.txt file with TWIG.

This is our robotstxt CMS page with twig variables:

title = "robots"
url = "/robots"
is_hidden = 0
function onStart()
    $this->setResponseHeader('Content-Type', 'text/plain');
Modified: 9-27-2019
User-agent: *
Allow: /
Disallow: /api/*
Disallow: /payment/*

{% set baseUrl = url('/') %}
Disallow: {{ 'myCustomPage'|page(false)|replace({ (baseUrl): '' }) }}

Sitemap: {{ url('/') }}/sitemap.xml



We use cookies to measure the performance of this website. Do you want to accept these cookies?