Search code examples
pythonhtmllocalizationinternationalizationpelican

Pelican i18n subsites menu items override


I am building a static site with Pelican and the i18n subsites plugin.

The way I understand it, you can override settings in pelicanconf.py with this plugin, but I don’t think the way I did it is working.

Pelicanconf.py:

I18N_SUBSITES = {
    'nl': {
        'SITENAME': 'Robin Berghuijs Design',
        'INDEX_SAVE_AS': 'nieuws.html',
        'MENUITEMS': [
            ('Nieuws','nieuws.html'),
        ],
    },
    'en': {
        'SITENAME': 'Robin Berghuijs Design',
        'INDEX_SAVE_AS': 'news.html',
        'MENUITEMS': [
            ('News','news.html'),
        ],
    }
}

Index.html output:

<nav id="menu"><ul>
    <li><a href="./pages/contact.html">Contact</a></li>
</ul></nav><!-- /#menu -->

base.html template:

    {% for title, link in MENUITEMS %}
        <li><a href="{{ link }}">{{ title }}</a></li>
    {% endfor %}

I get no errors upon site generation. More detail here.

Running pelican with --debug gives this.


Solution

  • As it turns out, the i18n subsites plugin was creating two new sites, with the old one left in the output folder. So there was a site in output/, one in output/nl/, and one in output/en/. Adding DELETE_OUTPUT_DIRECTORY = True and 'OUTPUT_PATH': '', to the Dutch i18n subsites settings solved the issue.