Add robots

This commit is contained in:
Digital Studium 2023-07-23 20:47:37 +03:00
parent f0ecde0932
commit 3c5e1cc3c8
1 changed files with 10 additions and 0 deletions

View File

@ -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
@ -155,6 +156,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)