Skip to content

Commit edcb419

Browse files
committed
Plausible Analytics
1 parent ca156b8 commit edcb419

File tree

5 files changed

+40
-3
lines changed

5 files changed

+40
-3
lines changed

tasks/main.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,9 @@
4545
- name: Include Django management tasks
4646
ansible.builtin.import_tasks: django.yml
4747

48+
- name: Include Plausible Analytics
49+
ansible.builtin.import_tasks: plausible.yml
50+
4851
- name: Include Nginx tasks
4952
ansible.builtin.import_tasks: nginx.yml
5053
when: mailman3_install_nginx

tasks/plausible.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
---
2+
3+
- name: Create directories for templates
4+
ansible.builtin.file:
5+
path: "{{ item }}"
6+
state: directory
7+
owner: "{{ __mailman3_web_user_name }}"
8+
group: "{{ __mailman3_web_group_name }}"
9+
mode: "0755"
10+
loop:
11+
- '{{ mailman3_web_var_dir }}/templates/hyperkitty'
12+
- '{{ mailman3_web_var_dir }}/templates/postorius'
13+
14+
# The files installed here have the potential to be more general, and used by other services.
15+
# If that occurs, reorganize the tasks
16+
17+
- name: Install templates needed for Plausible
18+
ansible.builtin.template:
19+
src: "{{ item.src }}"
20+
dest: "{{ item.dest }}"
21+
owner: "{{ __mailman3_web_user_name }}"
22+
group: "{{ __mailman3_web_group_name }}"
23+
mode: "0755"
24+
loop:
25+
- { src: 'hyperkitty-headers.html.j2', dest: '{{ mailman3_web_var_dir }}/templates/hyperkitty/headers.html' }
26+
- { src: 'postorius-base.html.j2', dest: '{{ mailman3_web_var_dir }}/templates/postorius/base.html' }
27+
notify:
28+
- Restart mailman3-web service
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<script defer data-domain="{{ mailman3_web_url }}" src="https://plausible.io/js/script.js"></script>

templates/postorius-base.html.j2

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{{ '{%' }} extends 'postorius/base.html' {{ '%}' }}
2+
3+
{{ '{%' }} block additionalcss {{ '%}' }}
4+
<script defer data-domain="{{ mailman3_web_url }}" src="https://plausible.io/js/script.js"></script>
5+
{{ '{%' }} endblock {{ '%}' }}

templates/settings.py.j2

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,6 @@ BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
210210
# os.path.join(BASE_DIR, 'static_custom')
211211
# ]
212212
#
213-
# TEMPLATES[0]['DIRS'] = [
214-
# os.path.join(BASE_DIR, 'templates')
215-
# ]
213+
TEMPLATES[0]['DIRS'] = [
214+
os.path.join(BASE_DIR, 'templates')
215+
]

0 commit comments

Comments
 (0)