Skip to content

Commit

Permalink
Older versions of the standard should not be indexed
Browse files Browse the repository at this point in the history
  • Loading branch information
odscjames committed Oct 25, 2024
1 parent 28a16bc commit a0abf2b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 19 deletions.
23 changes: 4 additions & 19 deletions iati_standard/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -406,25 +406,10 @@ class ActivityStandardPage(AbstractGithubPage):

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),
}
]
def is_older_version_of_standard(self):
"""Is it an older version of the standard. Return Boolean."""
url = self.get_url()
return re.match(r"^\/\w+\/iati-standard\/\d", url) and not re.match(r"^\/\w+\/iati-standard\/203\/", url)


class StandardGuidancePage(AbstractGithubPage):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@
</style>
{% endblock %}

{% block html_header_seo %}
{% if page.is_older_version_of_standard %}<meta name="robots" content="noindex">{% endif %}
{% endblock %}

{% block content %}
{% get_current_language as LANGUAGE_CODE %}
<div class="hero hero--minor">
Expand Down

0 comments on commit a0abf2b

Please sign in to comment.