From 616f2450dc61499b06b4afe7cd750d348b1c267a Mon Sep 17 00:00:00 2001 From: Ahtisahm Shahid Date: Tue, 11 Aug 2026 11:48:07 +0500 Subject: [PATCH 1/2] Block search engines from indexing OVS Adds a noindex/nofollow meta tag to base.html (inherited by every page) and fixes robots.txt, which had an empty Disallow value that was actually permitting all crawling. Fixes mitodl/hq#12798 --- odl_video/robots_test.py | 14 ++++++++++++++ static/robots.txt | 2 +- ui/templates/base.html | 1 + ui/views_test.py | 8 ++++++++ 4 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 odl_video/robots_test.py diff --git a/odl_video/robots_test.py b/odl_video/robots_test.py new file mode 100644 index 000000000..9564ec5dd --- /dev/null +++ b/odl_video/robots_test.py @@ -0,0 +1,14 @@ +"""Tests for the site's robots.txt""" + +import os + +from django.conf import settings + + +def test_robots_txt_disallows_all(): + """robots.txt should block all crawlers (see mitodl/hq#12798)""" + robots_path = os.path.join(settings.BASE_DIR, "static", "robots.txt") + with open(robots_path) as robots_file: + content = robots_file.read() + assert "User-agent: *" in content + assert "Disallow: /" in content diff --git a/static/robots.txt b/static/robots.txt index eb0536286..1f53798bb 100644 --- a/static/robots.txt +++ b/static/robots.txt @@ -1,2 +1,2 @@ User-agent: * -Disallow: +Disallow: / diff --git a/ui/templates/base.html b/ui/templates/base.html index 76f30ca11..bb22a7562 100644 --- a/ui/templates/base.html +++ b/ui/templates/base.html @@ -6,6 +6,7 @@ {% load hijack %} +