7

I am working on a small project and I thought I'd give wagtail a try. I am now wondering how I could change wagtail's admin logo in the sidebar (top left image on the picture bellow).

github wagtail image

I could change /static/wagtailadmin/images/wagtail-logo.svg directly but it'd be wrong ;).

4

2 回答 2

9

Wagtail 已经使用django-overextends在官方文档中提供了解决方案:

要替换默认徽标,请创建一个your_app/templates/wagtailadmin/base.html覆盖块 branding_logo 的模板文件,如下所示:

{% overextends "wagtailadmin/base.html" %}

{% block branding_logo %}
    <img src="{{ STATIC_URL }}images/custom-logo.svg" alt="Custom Project" width="80" />
{% endblock %}

查看Wagtail 定制品牌了解更多详情。


(编辑 2020 年 12 月)

注意:在最新版本的 Wagtail 中django-overextends不再需要。它现在使用模板的默认extends标签。查阅文档以获取更多信息Django

于 2016-01-29T13:31:42.410 回答
8

徽标在此处定义:

https://github.com/torchbox/wagtail/blob/master/wagtail/wagtailadmin/templates/wagtailadmin/base.html#L7

要覆盖它,您需要一个包含templates/wagtailadmin/base.htmlwagtail 并位于 wagtail 之前的应用程序INSTALLED_APPS

祝你好运!

于 2014-07-02T18:48:10.133 回答