From 7659bf23d3ba0ad18338329ecf066b70b6585efc Mon Sep 17 00:00:00 2001 From: Karl Hobley Date: Fri, 17 Oct 2014 17:16:36 +0100 Subject: [PATCH] Use latest_revision_created_at in sitemap gen Much faster than looking it up manually for every page in the site --- wagtail/wagtailcore/models.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/wagtail/wagtailcore/models.py b/wagtail/wagtailcore/models.py index a4d0bed92..06ffb32a4 100644 --- a/wagtail/wagtailcore/models.py +++ b/wagtail/wagtailcore/models.py @@ -794,12 +794,10 @@ class Page(six.with_metaclass(PageBase, MP_Node, ClusterableModel, index.Indexed return ['/'] def get_sitemap_urls(self): - latest_revision = self.get_latest_revision() - return [ { 'location': self.full_url, - 'lastmod': latest_revision.created_at if latest_revision else None + 'lastmod': self.latest_revision_created_at } ]