Breadcrumb generates duplicate item for certain language

I am using a simple breadcrumb for my multilingual site:

    <?php foreach($site->breadcrumb() as $crumb): ?>
    <li class="menu__item<?php e($crumb->isActive(), ' is-active') ?>">
        <a href="<?= $crumb->url() ?>" class="menu__link"><?= $crumb->title()->html() ?></a>
    <?php endforeach; ?>

On german, everything works as aspected, but on the english site it outputs the home directory twice.

This is in my config.php:

c::set('home', 'touren');



Does it still happen if you take the config setting out?

But it would be cool to set the Touren page as homepage.

Hm, I can’t really reproduce this in a Langkit. does the home folder still exist?

Could you post your configuration?

No, I delete it.
When I added it back it works as aspected.

Hm, weird, even if I remove the home folder, I don’t get any duplicates.

Edit: Ok, it happens only when visiting subpages, right?

Yes @texnixe

But I am avoiding the problem when adding the homepage back.

So it is ok for me … thanks!

Are you maybe using Url-Keys for the non-default language?

Maybe this is a bug, after all…

Would be nice to know what the actual cause was though, incase it turns out to be bug.

I have a multilingual site (English, Arabic, French). Ill throw the breadcrumb into it a little later and see if it can make this happen.

Can you let us know which PHP version you are using and what you are using as a local server, and Kirby versions?

1 Like

As I said, as soon as I throw in URL-Keys, this happens, so I’d consider this a bug.

Even when I added back the home folder, it duplicates the english breadcrumb.

c::set('home', 'touren');

So, is there a solution for it or is it a serious bug?

yes, I created an issue on GitHub:

It only seems to happen with URL-keys, not matter if the home folder is present or not.

You could try to create a custom breadcrumb method that only adds the home folder to the set for the non-default language if URL-Keys are used.

1 Like