Add support for injecting HTML before the </head> tag in inject plugin

This commit is contained in:
Théophile Diot 2024-11-08 16:59:35 +01:00
parent d90b980cc6
commit eae5439861
No known key found for this signature in database
GPG key ID: FA995104A0BA376A
2 changed files with 15 additions and 3 deletions

View file

@ -1,3 +1,6 @@
{% if INJECT_BODY != "" +%}
sub_filter '</body>' '{{ INJECT_BODY }}</body>';
{% endif %}
{% if INJECT_HEAD != "" +%}
sub_filter '</head>' '{{ INJECT_HEAD }}</head>';
{% endif %}

View file

@ -1,16 +1,25 @@
{
"id": "inject",
"name": "HTML injection",
"description": "Inject custom HTML code before the </body> tag.",
"description": "Inject custom HTML code before either the </body> or </head> tag.",
"version": "1.0",
"stream": "no",
"settings": {
"INJECT_BODY": {
"context": "multisite",
"default": "",
"help": "The HTML code to inject.",
"help": "The HTML code to inject before the </body> tag.",
"id": "inject-body",
"label": "HTML code",
"label": "body HTML code",
"regex": "^.*$",
"type": "text"
},
"INJECT_HEAD": {
"context": "multisite",
"default": "",
"help": "The HTML code to inject before the </head> tag.",
"id": "inject-body",
"label": "head HTML code",
"regex": "^.*$",
"type": "text"
}