mirror of
https://github.com/Hopiu/wagtail.git
synced 2026-05-08 23:44:44 +00:00
Documentation for replacing branding using django-overextends (+ rename admin_logo to branding_logo with the plan of being consistent with #934)
This commit is contained in:
parent
01b67760c0
commit
dbc7cf45ef
4 changed files with 33 additions and 25 deletions
|
|
@ -1,24 +0,0 @@
|
|||
Change Logo in Dashboard
|
||||
========================
|
||||
|
||||
In your projects with Wagtail, maybe need switch the default logo to other image. For this, you need override the block ``logo_admin``::
|
||||
|
||||
{% extends "wagtailadmin/base.html" %}
|
||||
|
||||
{% block admin_logo %}
|
||||
<img src="{{ STATIC_URL }}images/custom-logo.svg" alt="Custom Project" width="80" />
|
||||
{% endblock %}
|
||||
|
||||
|
||||
Save this in your app, for example, ``dashboard`` to ``dashboard/templates/wagtailadmin/base.html`` and register before ``wagtailadmin``::
|
||||
|
||||
INSTALLED_APPS = (
|
||||
# ...
|
||||
|
||||
'dashboard',
|
||||
|
||||
'wagtail.wagtailcore',
|
||||
'wagtail.wagtailadmin',
|
||||
|
||||
# ...
|
||||
)
|
||||
31
docs/howto/custom_branding.rst
Normal file
31
docs/howto/custom_branding.rst
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
Custom branding
|
||||
===============
|
||||
|
||||
In your projects with Wagtail, you may wish to replace elements such as the Wagtail logo within the admin interface with your own branding. This can be done through Django's template inheritance mechanism, along with the `django-overextends <https://github.com/stephenmcd/django-overextends>`_ package.
|
||||
|
||||
Install django-overextends with ``pip install django-overextends`` (or add ``django-overextends`` to your project's requirements file), and add ``'overextends'`` to your project's ``INSTALLED_APPS``. You now need to create a ``templates/wagtailadmin/`` folder within one of your apps - this may be an existing one, or a new one created for this purpose, for example, ``dashboard``. This app must be registered in ``INSTALLED_APPS`` before ``wagtail.wagtailadmin``::
|
||||
|
||||
INSTALLED_APPS = (
|
||||
# ...
|
||||
|
||||
'overextends',
|
||||
'dashboard',
|
||||
|
||||
'wagtail.wagtailcore',
|
||||
'wagtail.wagtailadmin',
|
||||
|
||||
# ...
|
||||
)
|
||||
|
||||
The template blocks that are available to be overridden are as follows:
|
||||
|
||||
branding_logo
|
||||
-------------
|
||||
|
||||
To replace the default logo, create a template file ``dashboard/templates/wagtailadmin/base.html`` that overrides the block ``branding_logo``::
|
||||
|
||||
{% overextends "wagtailadmin/base.html" %}
|
||||
|
||||
{% block branding_logo %}
|
||||
<img src="{{ STATIC_URL }}images/custom-logo.svg" alt="Custom Project" width="80" />
|
||||
{% endblock %}
|
||||
|
|
@ -9,4 +9,5 @@ How to
|
|||
deploying
|
||||
performance
|
||||
multilingual_sites
|
||||
custom_branding
|
||||
contributing
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
<div class="nav-wrapper">
|
||||
<div class="inner">
|
||||
<a href="{% url 'wagtailadmin_home' %}" class="logo" title="Wagtail v.{% wagtail_version %}">
|
||||
{% block admin_logo %}
|
||||
{% block branding_logo %}
|
||||
<img src="{{ STATIC_URL }}wagtailadmin/images/wagtail-logo.svg" alt="Wagtail" width="80" />
|
||||
{% endblock %}
|
||||
<span>{% trans "Dashboard" %}</span>
|
||||
|
|
|
|||
Loading…
Reference in a new issue