# Indico Header and Footer customisation within a plugin

**URL:** <https://talk.getindico.io/t/indico-header-and-footer-customisation-within-a-plugin/1059>\
**Category:** Plugin Development\
**Created:** [March 20, 2019, 4:36pm UTC](https://talk.getindico.io/t/indico-header-and-footer-customisation-within-a-plugin/1059 "2019-03-20T16:36:58Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![openprojects](https://talk.getindico.io/user_avatar/talk.getindico.io/openprojects/32/205_2.png) [@openprojects](https://talk.getindico.io/u/openprojects)\
**Post date:** [March 20, 2019, 4:36pm UTC](https://talk.getindico.io/t/indico-header-and-footer-customisation-within-a-plugin/1059/1 "2019-03-20T16:36:58Z")

</div>

Hi,  
my goal is to customise the header and footer of Indico (extending or replacing blocks).  
I already read Natalia’s nice HOW TO “[Any colour you like](https://indico.cern.ch/event/614422/contributions/2703408/attachments/1543373/2421298/Indico_customization.pdf)”, but I would like to do it in a plugin, not with a separate DIR specified in indico.conf .  
Adding my custom plugin should allow me to customise everything…  
Is it possible? Do you have any example?  
Thank you,

Giorgio

---

<div class="post-metadata">

**Author:** ![ThiefMaster](https://talk.getindico.io/user_avatar/talk.getindico.io/thiefmaster/32/509_2.png) [@ThiefMaster](https://talk.getindico.io/u/ThiefMaster)\
**Post date:** [March 20, 2019, 4:39pm UTC](https://talk.getindico.io/t/indico-header-and-footer-customisation-within-a-plugin/1059/2 "2019-03-20T16:39:43Z")

</div>

```python
    def init(self):
        super(YourPlugin, self).init()
        self.connect(signals.plugin.get_template_customization_paths, self._override_templates)

    def _override_templates(self, sender, **kwargs):
        return os.path.join(self.root_path, 'template_overrides')

```

Then that directory inside your plugin’s package can be used like the the template customization dir.

---

<div class="post-metadata">

**Author:** ![openprojects](https://talk.getindico.io/user_avatar/talk.getindico.io/openprojects/32/205_2.png) [@openprojects](https://talk.getindico.io/u/openprojects)\
**Post date:** [March 25, 2019, 10:58am UTC](https://talk.getindico.io/t/indico-header-and-footer-customisation-within-a-plugin/1059/3 "2019-03-25T10:58:12Z")

</div>

Thank you!  
I did it, but if in that dir (“templates\_overrides”) I create a “header.html” with some “block logo” customisations, it is not loaded and still it goes to the default header.html template…  
Any ideas?

---

<div class="post-metadata">

**Author:** ![ThiefMaster](https://talk.getindico.io/user_avatar/talk.getindico.io/thiefmaster/32/509_2.png) [@ThiefMaster](https://talk.getindico.io/u/ThiefMaster)\
**Post date:** [March 25, 2019, 11:00am UTC](https://talk.getindico.io/t/indico-header-and-footer-customisation-within-a-plugin/1059/4 "2019-03-25T11:00:14Z")

</div>

You need to use the same structure as you would use for other overrides, so `template_overrides/core/header.html` if you want to override `indico/web/templates/header.html`

---

<div class="post-metadata">

**Author:** ![openprojects](https://talk.getindico.io/user_avatar/talk.getindico.io/openprojects/32/205_2.png) [@openprojects](https://talk.getindico.io/u/openprojects)\
**Post date:** [March 25, 2019, 11:12am UTC](https://talk.getindico.io/t/indico-header-and-footer-customisation-within-a-plugin/1059/5 "2019-03-25T11:12:52Z")

</div>

Thank you!  
I was gettin crazy… It works like a charm now!

---

<div class="post-metadata">

**Author:** ![openprojects](https://talk.getindico.io/user_avatar/talk.getindico.io/openprojects/32/205_2.png) [@openprojects](https://talk.getindico.io/u/openprojects)\
**Post date:** [March 26, 2019, 2:00pm UTC](https://talk.getindico.io/t/indico-header-and-footer-customisation-within-a-plugin/1059/6 "2019-03-26T14:00:50Z")

</div>

Still related to the topic: I’m now trying to inject a UNOG.CSS file.  
I tried adding `inject_bundle` in the class ` __init__ `, but I got a “manifest.json not found” error.  
Than I found the topic: [Theme plugin: How to integrate logos](https://talk.getindico.io/t/theme-plugin-how-to-integrate-logos/465) and I understood there are differences from 2.1 to 2.2/master in terms of plugin writing: after switching to 2.1 I got a “AttributeError: ‘module’ object has no attribute ‘get\_template\_customization\_paths’” error.  
So the question is: what is the “stable” version I should use? 2.1.8 or 2.2master (or something else)?

---

<div class="post-metadata">

**Author:** ![ThiefMaster](https://talk.getindico.io/user_avatar/talk.getindico.io/thiefmaster/32/509_2.png) [@ThiefMaster](https://talk.getindico.io/u/ThiefMaster)\
**Post date:** [March 27, 2019, 1:08am UTC](https://talk.getindico.io/t/indico-header-and-footer-customisation-within-a-plugin/1059/7 "2019-03-27T01:08:00Z")

</div>

Use master for any new development.

If you use a bundle in a plugin, you need to build the assets using the same script you also use to build the assets for indico itself - you just need to call it with different arguments:

```
$ python bin/maintenance/build-assets.py plugin --dev --watch ../plugins/yourplugin
```

---

<div class="post-metadata">

**Author:** ![openprojects](https://talk.getindico.io/user_avatar/talk.getindico.io/openprojects/32/205_2.png) [@openprojects](https://talk.getindico.io/u/openprojects)\
**Post date:** [March 27, 2019, 10:53am UTC](https://talk.getindico.io/t/indico-header-and-footer-customisation-within-a-plugin/1059/8 "2019-03-27T10:53:05Z")

</div>

OK, I understand how to create the manifest.json and the bundle now 😉  
It worked, thank you!  
It is a bit curious that to inject a CSS I need to create a JS and import the css, but… it’s ok.  
Last “stupid” question: in the css I would like use and IMAGE as background.  
How can I point at it?  
To make it work I did: background-image: url(…/…/images/unog\_bg.jpg);  
…but It’s not very elegant (I placed the image in static/images).  
Is there a better way?  
Thank you,

Giorgio
