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
jarofgreen committed Oct 25, 2024
1 parent 947d230 commit 52292a7
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
3 changes: 3 additions & 0 deletions iati/templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@
{% block extra_css %}
{# Override this in templates to add extra stylesheets #}
{% endblock %}

{% block html_header_seo %}
{% endblock %}
</head>

<body class="body--message {% block body_class %}{% endblock %}" id="{% block body_id %}{% endblock %}">
Expand Down
12 changes: 11 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,19 @@ 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 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):
"""A model for the Standard Guidance Page, an IATI reference page."""
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 52292a7

Please sign in to comment.