Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#2805 closed enhancement (fixed)

[patch] make sitemaps more space effective

Reported by: Maximillian dornseif <md@…> Owned by: adrian
Component: Contrib apps Version: 0.95
Severity: trivial Keywords:
Cc: Triage Stage: Unreviewed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

The XML generates by sitemaps contains lot of whitespace. Since sitemaps are meant to be only processed by machines and the templates are only seldom edited by humans it makes sense to strip out most unneeded whitespace. Basically this is a readability bandwidth tradeoff. This patch changes the sitemaps framework to use the same approach as the syndication framework: prefer bandwidth over readability. It reduced the size of my sitemap by about 20 %.

Get the Patch at http://c0re.23.nu/c0de/misc/django-3810-sitemap_space_saver.diff

Attachments (1)

django-3810-sitemap_space_saver.diff.txt (1.6 KB) - added by md@… 8 years ago.

Download all attachments as: .zip

Change History (3)

Changed 8 years ago by md@…

comment:1 Changed 8 years ago by adrian

Readability of XML is not important, but readability of templates *is* important. A good solution could be to use the {% spaceless %} template tag to strip the space on output. I'll check in that change momentarily.

Also note that if you're super concerned about bandwidth, just use gzip for your sitemap. See the djangoproject.com URLconf for an example of how to do that.

comment:2 Changed 8 years ago by adrian

  • Resolution set to fixed
  • Status changed from new to closed

(In [3869]) Fixed #2805 -- Removed some whitespace from the two sitemap XML templates.

Note: See TracTickets for help on using tickets.
Back to Top