Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion docs/admin/configure.rst
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,10 @@ If desired, the name of this directory may be changed or a separate subdirectory
for template files may be created by editing
the wikiconfig file and changing the line that defines `template_dirs`::

template_dirs = [os.path.join(wikiconfig_dir, 'wiki_local'), ]
template_dirs = [os.path.join(wikiconfig_dir, "wiki_local")]

Simple customizations using CSS can be made by providing a file named `custom.css`
in the `wiki_local` subdirectory.

Using a custom snippets.html template
-------------------------------------
Expand Down
1 change: 1 addition & 0 deletions src/moin/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@ class ItemNameConverter(PathConverter):
if app.cfg.template_dirs:
app.jinja_env.loader = ChoiceLoader([FileSystemLoader(app.cfg.template_dirs), app.jinja_env.loader])
app.register_error_handler(403, themed_error)
app.cfg.custom_css_path = os.path.isfile("wiki_local/custom.css")
clock.stop("create_app flask-theme")
# create global counter to limit content security policy reports, prevent spam
app.csp_count = 0
Expand Down
3 changes: 3 additions & 0 deletions src/moin/templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@
{%- if user.valid and user.css_url -%}
<link media="all" rel="stylesheet" title="{{ user.name }}'s stylesheet" href="{{ user.css_url }}">
{%- endif -%}
{%- if cfg.custom_css_path -%}
<link media="all" rel="stylesheet" href="{{ url_for('serve.files', name='wiki_local', filename='custom.css') }}">
{%- endif -%}
{%- endblock -%}
{%- endblock %}
</head>
Expand Down
Loading