{% if rules %}{% for rule in rules %}{% ifchanged rule.robot %}{% if not forloop.first %}
{% endif %}User-agent: {{ rule.robot }}{% endifchanged %}
{% for url in rule.allowed.all %}Allow: {{ url.pattern }}
{% endfor %}{% for url in rule.disallowed.all %}Disallow: {{ url.pattern }}
{% endfor %}{% if rule.crawl_delay %}Crawl-delay: {{ rule.crawl_delay }}
{% endif %}{% endfor %}{% else %}User-agent: *
Disallow: /
{% endif %}

{% for sitemap_url in sitemap_urls %}Sitemap: {{ sitemap_url }}
{% endfor %}