Commit a991b7a7 authored by David Hrbáč's avatar David Hrbáč Committed by Waylan Limberg
Browse files

Compressed sitemap.xml (#1130)

parent 84f9d16b
......@@ -6,6 +6,7 @@ from calendar import timegm
import io
import logging
import os
import gzip
from jinja2.exceptions import TemplateNotFound
import jinja2
......@@ -95,6 +96,11 @@ def build_template(template_name, env, config, site_navigation=None):
if output_content.strip():
output_path = os.path.join(config['site_dir'], template_name)
utils.write_file(output_content.encode('utf-8'), output_path)
if template_name == 'sitemap.xml':
log.debug("Gzipping template: %s", template_name)
with'{}.gz'.format(output_path), 'wb') as f:
else:"Template skipped: '{}'. Generated empty output.".format(template_name))
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment