Skip to content

Commit

Permalink
Ref mozilla#15224: Remove use of etags and lastmod data from sitemap …
Browse files Browse the repository at this point in the history
…generation
  • Loading branch information
pmac committed Sep 27, 2024
1 parent bb83e23 commit 98a6bab
Showing 1 changed file with 3 additions and 15 deletions.
18 changes: 3 additions & 15 deletions bedrock/sitemaps/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,33 +12,21 @@


def load_sitemaps_data():
with SITEMAPS_DATA.joinpath("etags.json").open() as fh:
etags = json.load(fh)

with SITEMAPS_DATA.joinpath("sitemap.json").open() as fh:
sitemap = json.load(fh)

return sitemap, etags
return sitemap


def get_sitemap_objs():
objs = []
sitemap, etags = load_sitemaps_data()
sitemap = load_sitemaps_data()
for url, locales in sitemap.items():
if not locales:
locales = [NO_LOCALE]

for locale in locales:
if locale == NO_LOCALE:
full_url = f"{settings.CANONICAL_URL}{url}"
else:
full_url = f"{settings.CANONICAL_URL}/{locale}{url}"

kwargs = {"path": url, "locale": locale}
etag = etags.get(full_url)
if etag:
kwargs["lastmod"] = etag["date"]
objs.append(SitemapURL(**kwargs))
objs.append(SitemapURL(path=url, locale=locale))

return objs

Expand Down

0 comments on commit 98a6bab

Please sign in to comment.