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">
|
<meta name="color-scheme" content="light dark">
|
||||||
<title>{% block title %}Home | {% endblock %}{{ blog_title }} by {{ blog_author }}</title>
|
<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' %}">
|
<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" %}
|
{% include "articles/snippets/page_metadata.html" %}
|
||||||
|
|
||||||
{% compress css inline %}
|
{% compress css inline %}
|
||||||
|
|
|
@ -1,13 +1,14 @@
|
||||||
{% load static compress %}
|
{% load static compress %}
|
||||||
|
|
||||||
{% if plausible_domain is not None and not user.is_authenticated %}
|
{% if not user.is_authenticated %}
|
||||||
|
{% if plausible_domain is not None %}
|
||||||
<script async defer data-domain="{{ plausible_domain }}"
|
<script async defer data-domain="{{ plausible_domain }}"
|
||||||
src="https://plausible.augendre.info/js/plausible.js">
|
src="https://plausible.augendre.info/js/plausible.js">
|
||||||
</script>
|
</script>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% compress js inline %}
|
{% compress js inline %}
|
||||||
{% if goatcounter_domain is not None and not user.is_authenticated %}
|
{% if goatcounter_domain is not None %}
|
||||||
<script>
|
<script>
|
||||||
window.goatcounter = {
|
window.goatcounter = {
|
||||||
endpoint: 'https://{{ goatcounter_domain }}/count',
|
endpoint: 'https://{{ goatcounter_domain }}/count',
|
||||||
|
@ -16,4 +17,5 @@
|
||||||
</script>
|
</script>
|
||||||
<script async defer src="{% static "vendor/goatcounter.js" %}"></script>
|
<script async defer src="{% static "vendor/goatcounter.js" %}"></script>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endcompress %}
|
{% 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