From 3c5e1cc3c8720c8e3cac272edc0799d4d9d9fd21 Mon Sep 17 00:00:00 2001 From: Digital Studium Date: Sun, 23 Jul 2023 20:47:37 +0300 Subject: [PATCH] Add robots --- franca.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/franca.py b/franca.py index 6c5aa21..b2ce0c4 100644 --- a/franca.py +++ b/franca.py @@ -72,6 +72,7 @@ def crater(prod=False): # Load base jinja template base = templates.get_template("base.j2") + index = templates.get_template("index.j2") # Load translations global translations @@ -154,6 +155,15 @@ def crater(prod=False): copy_file('static/logo.svg', 'public/') copy_file('static/favicon.ico', 'public/') + + # Write main index.html + html = index.render(config=config) + write_file('public/index.html', html) + # Write robots.txt + robots_content = "User-agent: *\nDisallow: /" + if config.get('search_engines', None) == "allow": + robots_content = robots_content.rstrip("/") + write_file('public/robots.txt', robots_content) develop(prod)