diff --git a/core/models/config.py b/core/models/config.py index eb07313..51dd2df 100644 --- a/core/models/config.py +++ b/core/models/config.py @@ -235,6 +235,8 @@ class Config(models.Model): restricted_usernames: str = "admin\nadmins\nadministrator\nadministrators\nsystem\nroot\nannounce\nannouncement\nannouncements" + custom_head: str | None + class UserOptions(pydantic.BaseModel): pass diff --git a/templates/base.html b/templates/base.html index a67c692..264beea 100644 --- a/templates/base.html +++ b/templates/base.html @@ -30,6 +30,7 @@ {% include "_opengraph.html" with opengraph_local=opengraph_defaults %} {% endblock %} {% block extra_head %}{% endblock %} + {% block custom_head %}{% if config.custom_head %}{{ config.custom_head|safe }}{% endif %}{% endblock %}
Skip to Content diff --git a/users/views/admin/settings.py b/users/views/admin/settings.py index 0931e39..f6ed3a2 100644 --- a/users/views/admin/settings.py +++ b/users/views/admin/settings.py @@ -101,6 +101,11 @@ class BasicSettings(AdminSettingsPage): "title": "Show Public Timeline On Front Page", "help_text": "Whether to show some recent posts on the logged-out homepage", }, + "custom_head": { + "title": "HTML Extra", + "help_text": "Add custom HTML to the <head> of all pages (except /djadmin/).\nNote: This can break page rendering/layout.", + "display": "textarea", + }, } layout = { @@ -110,6 +115,7 @@ class BasicSettings(AdminSettingsPage): "site_icon", "site_banner", "highlight_color", + "custom_head", ], "Signups": [ "signup_allowed",