Skip to content

Commit

Permalink
sitemap: If older version of standard, want it to have lower priority.
Browse files Browse the repository at this point in the history
  • Loading branch information
odscjames committed Oct 25, 2024
1 parent 947d230 commit 444661c
Showing 1 changed file with 26 additions and 1 deletion.
27 changes: 26 additions & 1 deletion iati_standard/models.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""Model definitions for the iati_standard app."""

import os
import re
from bs4 import BeautifulSoup
from datetime import datetime

Expand Down Expand Up @@ -397,10 +398,34 @@ def save(self, *args, **kwargs):


class ActivityStandardPage(AbstractGithubPage):
"""A model for the Activity Standard Page, an IATI reference page."""
"""A model for the Activity Standard Page, an IATI reference page.
Used for Standard reference pages like /en/iati-standard/202/
And guidance developer pages like /en/guidance/developer/
"""

template = 'iati_standard/activity_standard_page.html'

def get_sitemap_urls(self, request=None):
"""If it's an older version of the standard, we want it to have a lower priority."""
url = self.get_url(request)
if re.match(r"^\/\w+\/iati-standard\/", url) and not re.match(r"^\/\w+\/iati-standard\/203\/", url):
return [
{
'location': self.get_full_url(request),
'lastmod': (self.last_published_at or self.latest_revision_created_at),
'changefreq': 'yearly',
'priority': .1,
}
]
else:
return [
{
'location': self.get_full_url(request),
'lastmod': (self.last_published_at or self.latest_revision_created_at),
}
]


class StandardGuidancePage(AbstractGithubPage):
"""A model for the Standard Guidance Page, an IATI reference page."""
Expand Down

0 comments on commit 444661c

Please sign in to comment.