Disable plausible on 404 and page protection pages

This commit is contained in:
Jake Howard 2023-05-05 12:00:51 +01:00
parent d85065d914
commit d52d532d81
Signed by: jake
GPG key ID: 57AFB45680EDD477
5 changed files with 13 additions and 6 deletions

View file

@ -4,6 +4,9 @@
{% block body_class %}page-404{% endblock %} {% block body_class %}page-404{% endblock %}
{# Disable Plausible on 404 page #}
{% block plausible %}{% endblock %}
{% block title %} {% block title %}
Page not found Page not found
{% wagtail_site as current_site %} {% wagtail_site as current_site %}

View file

@ -48,9 +48,10 @@
{% block extra_js %}{% endblock %} {% block extra_js %}{% endblock %}
{% block plausible %}
{% if not request.user.is_authenticated or not request.is_preview %} {% if not request.user.is_authenticated or not request.is_preview %}
{% plausible %} {% plausible %}
{% endif %} {% endif %}
{% endblock %}
</body> </body>
</html> </html>

View file

@ -6,6 +6,9 @@
{% block title %}Password required{% endblock %} {% block title %}Password required{% endblock %}
{# Disable Plausible on 404 page #}
{% block plausible %}{% endblock %}
{% block extra_head %}<meta name="robots" content="noindex" />{% endblock %} {% block extra_head %}<meta name="robots" content="noindex" />{% endblock %}
{% block main_content %} {% block main_content %}

View file

@ -22,7 +22,7 @@ class Error404PageTestCase(TestCase):
) )
def test_queries(self) -> None: def test_queries(self) -> None:
with self.assertNumQueries(25): with self.assertNumQueries(21):
self.client.get(self.url) self.client.get(self.url)

View file

@ -89,7 +89,7 @@ class SearchPageResultsTestCase(TestCase):
) )
def test_too_high_page(self) -> None: def test_too_high_page(self) -> None:
with self.assertNumQueries(50): with self.assertNumQueries(46):
response = self.client.get( response = self.client.get(
self.url, {"q": "post", "page": 3}, HTTP_HX_REQUEST="true" self.url, {"q": "post", "page": 3}, HTTP_HX_REQUEST="true"
) )