Add preconnect headers for goatcounter and plausible
This commit is contained in:
parent
2bbdef77a3
commit
9958b37699
3 changed files with 27 additions and 15 deletions
|
@ -9,6 +9,7 @@
|
|||
<meta name="color-scheme" content="light dark">
|
||||
<title>{% block title %}Home | {% endblock %}{{ blog_title }} by {{ blog_author }}</title>
|
||||
<link rel="alternate" type="application/rss+xml" title="Gab's Notes » Feed" href="{% url 'complete-feed' %}">
|
||||
{% include "articles/snippets/analytics_head.html" %}
|
||||
{% include "articles/snippets/page_metadata.html" %}
|
||||
|
||||
{% compress css inline %}
|
||||
|
|
|
@ -1,19 +1,21 @@
|
|||
{% load static compress %}
|
||||
|
||||
{% if plausible_domain is not None and not user.is_authenticated %}
|
||||
<script async defer data-domain="{{ plausible_domain }}"
|
||||
src="https://plausible.augendre.info/js/plausible.js">
|
||||
</script>
|
||||
{% endif %}
|
||||
|
||||
{% compress js inline %}
|
||||
{% if goatcounter_domain is not None and not user.is_authenticated %}
|
||||
<script>
|
||||
window.goatcounter = {
|
||||
endpoint: 'https://{{ goatcounter_domain }}/count',
|
||||
allow_local: true,
|
||||
}
|
||||
{% if not user.is_authenticated %}
|
||||
{% if plausible_domain is not None %}
|
||||
<script async defer data-domain="{{ plausible_domain }}"
|
||||
src="https://plausible.augendre.info/js/plausible.js">
|
||||
</script>
|
||||
<script async defer src="{% static "vendor/goatcounter.js" %}"></script>
|
||||
{% endif %}
|
||||
{% endcompress %}
|
||||
|
||||
{% compress js inline %}
|
||||
{% if goatcounter_domain is not None %}
|
||||
<script>
|
||||
window.goatcounter = {
|
||||
endpoint: 'https://{{ goatcounter_domain }}/count',
|
||||
allow_local: true,
|
||||
}
|
||||
</script>
|
||||
<script async defer src="{% static "vendor/goatcounter.js" %}"></script>
|
||||
{% endif %}
|
||||
{% endcompress %}
|
||||
{% endif %}
|
||||
|
|
9
articles/templates/articles/snippets/analytics_head.html
Normal file
9
articles/templates/articles/snippets/analytics_head.html
Normal file
|
@ -0,0 +1,9 @@
|
|||
{% if not user.is_authenticated %}
|
||||
{% if plausible_domain is not None %}
|
||||
<link rel="preconnect" href="https://plausible.augendre.info">
|
||||
{% endif %}
|
||||
|
||||
{% if goatcounter_domain is not None %}
|
||||
<link rel="preconnect" href="https://{{ goatcounter_domain }}">
|
||||
{% endif %}
|
||||
{% endif %}
|
Reference in a new issue