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 %}
{# Disable Plausible on 404 page #}
{% block plausible %}{% endblock %}
{% block title %}
Page not found
{% wagtail_site as current_site %}

View File

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

View File

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

View File

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

View File

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