mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2025-08-29 23:08:06 +02:00
Added configuration_filters
This commit is contained in:
@@ -7,10 +7,10 @@ This role enhances your Nginx configuration by conditionally injecting global Ma
|
||||
## Features
|
||||
|
||||
- **Global Matomo Tracking**
|
||||
When enabled (`global_matomo_tracking_enabled` is `true`), the role includes Matomo tracking configuration and injects the corresponding tracking script into your HTML.
|
||||
The role includes Matomo tracking configuration and injects the corresponding tracking script into your HTML.
|
||||
|
||||
- **Global Theming**
|
||||
When enabled (`global_theming_enabled` is `true`), the role injects a global CSS link for consistent theming across your site.
|
||||
The role injects a global CSS link for consistent theming across your site.
|
||||
|
||||
- **Smart Injection**
|
||||
Uses Nginx's `sub_filter` to insert the tracking and theming snippets right before the closing `</head>` tag of your HTML documents.
|
||||
|
@@ -1,2 +0,0 @@
|
||||
dependencies:
|
||||
- nginx-modifier-css # Just required to load once
|
@@ -1,3 +1,8 @@
|
||||
- name: "Activate Global CSS for {{domain}}"
|
||||
include_role:
|
||||
name: nginx-modifier-css
|
||||
when: applications | get_css_enabled(application_id)
|
||||
|
||||
- name: "Activate Global Matomo Tracking for {{domain}}"
|
||||
include_role:
|
||||
name: nginx-modifier-matomo
|
||||
|
@@ -7,11 +7,11 @@ sub_filter_types text/html;
|
||||
{% include 'roles/nginx-modifier-matomo/templates/matomo-tracking.conf.j2' %}
|
||||
{% endif %}
|
||||
|
||||
{% if global_theming_enabled | bool or global_matomo_tracking_enabled | bool%}
|
||||
sub_filter '</head>' '{% if global_matomo_tracking_enabled | bool %}{% include 'roles/nginx-modifier-matomo/templates/script.j2' %}{% endif %}{% if global_theming_enabled | bool %}{% include 'roles/nginx-modifier-css/templates/link.j2' %}{% endif %}</head>';
|
||||
{% if applications | get_css_enabled(application_id) or global_matomo_tracking_enabled | bool%}
|
||||
sub_filter '</head>' '{% if global_matomo_tracking_enabled | bool %}{% include 'roles/nginx-modifier-matomo/templates/script.j2' %}{% endif %}{% if applications | get_css_enabled(application_id) %}{% include 'roles/nginx-modifier-css/templates/link.j2' %}{% endif %}</head>';
|
||||
{% endif %}
|
||||
|
||||
{% if global_theming_enabled | bool %}
|
||||
{% if applications | get_css_enabled(application_id) %}
|
||||
{# Include Global CSS Location #}
|
||||
{% include 'roles/nginx-modifier-css/templates/location.conf.j2' %}
|
||||
{% endif %}
|
||||
|
Reference in New Issue
Block a user