Huge role refactoring/cleanup. Other commits will propably follow. Because some bugs will exist. Still important for longrun and also for auto docs/help/slideshow generation

This commit is contained in:
2025-07-08 23:43:13 +02:00
parent 6b87a049d4
commit 563d5fd528
1242 changed files with 2301 additions and 1355 deletions

View File

@@ -0,0 +1,29 @@
# Nginx Global Matomo & Theming Modifier Role 🚀
This role enhances your Nginx configuration by conditionally injecting global Matomo tracking and theming elements into your HTML responses. It uses Nginx sub-filters to seamlessly add tracking scripts and CSS links to your web pages.
---
## Features
- **Global Matomo Tracking**
The role includes Matomo tracking configuration and injects the corresponding tracking script into your HTML.
- **Global Theming**
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.
This will automatically activate Matomo tracking and/or global theming based on your configuration.
---
## Author
Developed by [Kevin Veen-Birkenbach](https://www.veen.world) 😎
---
Happy automating! 🎉

View File

@@ -0,0 +1,19 @@
- name: "Activate Global CSS for {{domain}}"
include_role:
name: webserver-injector-css
when: applications | is_feature_enabled('css',application_id)
- name: "Activate Global Matomo Tracking for {{domain}}"
include_role:
name: webserver-injector-matomo
when: applications | is_feature_enabled('matomo',application_id)
- name: "Activate Portfolio iFrame Notifier for {{ domain }}"
include_role:
name: webserver-injector-iframe
when: applications | is_feature_enabled('portfolio_iframe', application_id)
- name: "Activate Javascript for {{ domain }}"
include_role:
name: webserver-injector-javascript
when: applications | is_feature_enabled('javascript', application_id)

View File

@@ -0,0 +1,33 @@
{# Allow multiple sub_filters #}
sub_filter_once off;
sub_filter_types text/html;
{% set modifier_css_enabled = applications | is_feature_enabled('css',application_id) %}
{% set modifier_matomo_enabled = applications | is_feature_enabled('matomo',application_id) %}
{% set modifier_iframe_enabled = applications | is_feature_enabled('portfolio_iframe',application_id) %}
{% set modifier_javascript_enabled = applications | is_feature_enabled('javascript',application_id) %}
{% if modifier_iframe_enabled or modifier_css_enabled or modifier_matomo_enabled or modifier_javascript_enabled %}
sub_filter '</head>' '
{%- if modifier_css_enabled -%}
{%- include "roles/webserver-injector-css/templates/head_sub.j2" -%}
{%- endif -%}
{%- if modifier_matomo_enabled -%}
{%- include "roles/webserver-injector-matomo/templates/head_sub.j2" -%}
{%- endif -%}
{%- if modifier_iframe_enabled -%}
{%- include "roles/webserver-injector-iframe/templates/head_sub.j2" -%}
{%- endif -%}
{%- if modifier_javascript_enabled -%}
{%- include "roles/webserver-injector-javascript/templates/head_sub.j2" -%}
{%- endif -%}
</head>';
{% endif %}
{% if modifier_css_enabled | bool %}
{% include 'roles/webserver-injector-css/templates/location.conf.j2' %}
{% endif %}
{% if modifier_matomo_enabled %}
{% include 'roles/webserver-injector-matomo/templates/matomo-tracking.conf.j2' %}
{% endif %}