# Strange Bug on Multilanguage-Page for Titles

**URL:** <https://forum.getkirby.com/t/strange-bug-on-multilanguage-page-for-titles/8944>\
**Category:** Questions\
**Tags:** v2\
**Created:** [November 4, 2017, 1:40pm UTC](https://forum.getkirby.com/t/strange-bug-on-multilanguage-page-for-titles/8944 "2017-11-04T13:40:12Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![ToGe88](https://avatars.discourse-cdn.com/v4/letter/t/c68b51/32.png) [@ToGe88](https://forum.getkirby.com/u/ToGe88)\
**Post date:** [November 4, 2017, 1:40pm UTC](https://forum.getkirby.com/t/strange-bug-on-multilanguage-page-for-titles/8944/1 "2017-11-04T13:40:12Z")

</div>

Hi there,

i have a very urgent problem with page titles on a page that went live yesterday evening. I cannot figure out where this error comes from and hope for some suggestions from you guys…

I have a menu as a sidebar, some breadcrumbs and a page title on almost every page. When an Headline is set in the backend, the page title gets replaced by that. Furthermore i have the URL-Key method for setting the URL to the english version.

In the sidebar menu, only translated pages are visible by filtering them out with the Translations Plugin from flokosiol. In english this setting is set for the trends and the sustainability pages. But now they appear, which they shouldn’t:

 ![image](https://europe1.discourse-cdn.com/flex017/uploads/getkirby/original/2X/4/41ba966a968f771e69cda9726a92f8526d2c681b.png)

Somehow the german titles and statusses are getting pulled and i don’t know where the error may be. So as you can see the german title is getting pulled, although the english one is set.

 ![image](https://europe1.discourse-cdn.com/flex017/uploads/getkirby/original/2X/4/4b0c9f57bf316c7b37eda7d176ffd221fa25cf51.jpg)

As you can see none of the methods (that are default and used many times) works properly at this point…

I’m really thankful for any kind of help, as it’s really urgent.

Thanks so far.  
Tobi

---

<div class="post-metadata">

**Author:** ![texnixe](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/texnixe/32/5754_2.png) [@texnixe](https://forum.getkirby.com/u/texnixe)\
**Post date:** [November 4, 2017, 2:00pm UTC](https://forum.getkirby.com/t/strange-bug-on-multilanguage-page-for-titles/8944/2 "2017-11-04T14:00:09Z")

</div>

Hey Tobi,

please post your code (all that is necessary to understand this, blueprints, template code etc). The result is not really useful for finding out where the error might be.

---

<div class="post-metadata">

**Author:** ![ToGe88](https://avatars.discourse-cdn.com/v4/letter/t/c68b51/32.png) [@ToGe88](https://forum.getkirby.com/u/ToGe88)\
**Post date:** [November 4, 2017, 2:07pm UTC](https://forum.getkirby.com/t/strange-bug-on-multilanguage-page-for-titles/8944/3 "2017-11-04T14:07:47Z")

</div>

Hi Texnixe,

i try to send the (important) code:

Snippet for showing the Page Title (e.g. Headline)

```auto
<section id="page-title" class="page-title__wrapper col-1-1">
	<div class="page-title__holder grid">
		<div class="col-1-1">
  		<h1><?= e($page->headline()->isNotEmpty(), $page->headline()->html(), $page->title()) ?></h1>
  		</div>
	</div>
</section>

```

I think this is self-explaining…

And the Snippet for the Sidebar-Menu (Adaptation from the default Menu):

```auto

$language = $site->language();

$excluded = new Pages;
$excluded->add($site->index()->filterBy('template','*=','module'));
$excluded->add($site->index()->filterBy('intendedTemplate','*=','modules'));

// nested menu
$items = $pages->visible()->not($excluded)->not('home')->not('impressum')->not('agb')->not('kontakt')->not('newsletter')->not('news')->filterBy('translations','1');

// only show the menu if items are available
if($items->count()):

?>
<aside class="submenu__holder">
  <div class="submenu__background"></div>
  <div class="submenu__content aside-menu">
    <ul class="submenu__tree level-one <?= $_SESSION['gender'] ?>">
      <?php foreach($items as $item): ?>
        <li class="submenu__leaf level-one">
          <a<?php e($item->isOpen(), ' class="active"') ?> href="<?php echo $item->url() ?>"><h3><?php echo $item->title()->html() ?></h3></a>
          
          <? if($item->hasVisibleChildren()): ?>
            <?php

            // get all children for the current menu item

            $children = $item->children()->not($excluded)->filterBy('translations','1');

            // display the submenu if children are available
            if($children->count() > 0):

            ?>
            <ul class="submenu__tree level-two">
              <?php foreach($children as $child): ?>
              <li class="submenu__leaf level-two">
      	        <a<?php e($child->isOpen(), ' class="active"') ?> href="<?php echo $child->url() ?>"><?php echo $child->title()->html() ?>
      	        	
      	        </a>
              </li>
              <?php endforeach ?>
            </ul>
            <?php endif ?> 
          <? endif ?>
        </li>
      <?php endforeach ?>
      <? $subitems = new Pages; ?>
      <? $subitems->add(page('kontakt'))->add(page('impressum'))->add(page('agb')); ?>
      <ul class="submenu__tree level-two">
      <?php foreach($subitems as $item): ?>
        <li class="submenu__leaf level-two">
          <a<?php e($item->isOpen(), ' class="active"') ?> href="<?php echo $item->url() ?>"><?php echo $item->title()->html() ?></a>
          
        </li>
      <?php endforeach ?>
      </ul>
      <a class="underline" href="<?= $site->contactFB()->html() ?>" target="_blank">Facebook</a>
    </ul>
  </div>
</aside>
<?php endif ?>

```

And the Breadcrumb Snippet (also quite simple):

```auto
<nav class="breadcrumbs grid" itemprop="breadcrumb">

  <span prefix="v: http://rdf.data-vocabulary.org/#">
    <?php foreach($site->breadcrumb() AS $crumb): ?>
    <?php if ($crumb->isActive()): ?>
      <span typeof="v:Breadcrumb">
        <span class="breadcrumb__last" property="v:title">
          <?php echo $crumb->title() ?>
        </span>
      </span>
      <?php else: ?>
      <span typeof="v:Breadcrumb">
        <a class="breadcrumb__path-anchor" href="<?php echo $crumb->url() ?>" rel="v:url" property="v:title">
          <?php echo $crumb->title() ?>
        </a>
      </span>
    <?php endif ?>
    <?php endforeach ?>
  </span>
</nav>

```

I think the error is somewhere else…

Tobi

---

<div class="post-metadata">

**Author:** ![ToGe88](https://avatars.discourse-cdn.com/v4/letter/t/c68b51/32.png) [@ToGe88](https://forum.getkirby.com/u/ToGe88)\
**Post date:** [November 4, 2017, 2:13pm UTC](https://forum.getkirby.com/t/strange-bug-on-multilanguage-page-for-titles/8944/4 "2017-11-04T14:13:46Z")

</div>

And i think since it has been working properly all the times, that the error is somewhere else. We have been changing some URL-Keys in the near past, maybe this makes some problems? But i can’t figure out where we changed anythin, that conflicts with that, since this is such a default functionality…

---

<div class="post-metadata">

**Author:** ![bvdputte](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/bvdputte/32/8179_2.png) [@bvdputte](https://forum.getkirby.com/u/bvdputte)\
**Post date:** [November 4, 2017, 2:46pm UTC](https://forum.getkirby.com/t/strange-bug-on-multilanguage-page-for-titles/8944/5 "2017-11-04T14:46:53Z")

</div>

What is your site’s default language? If it is German, than I would expect them to be added.

- PS: What language is the website in where you’ve took screenshots?
- PS 2: On which pages is “translations” field “1”?

---

<div class="post-metadata">

**Author:** ![ToGe88](https://avatars.discourse-cdn.com/v4/letter/t/c68b51/32.png) [@ToGe88](https://forum.getkirby.com/u/ToGe88)\
**Post date:** [November 4, 2017, 3:04pm UTC](https://forum.getkirby.com/t/strange-bug-on-multilanguage-page-for-titles/8944/6 "2017-11-04T15:04:04Z")

</div>

Default language is German. The screenshots were taken on the English page. The field is 1 for every page you see in the English menu. Except for Leistungen and Nachhaltigkeit. What bothers me more is that there are different titles set in English but they only show up at the Leistungen leaf of the menu…

---

<div class="post-metadata">

**Author:** ![bvdputte](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/bvdputte/32/8179_2.png) [@bvdputte](https://forum.getkirby.com/u/bvdputte)\
**Post date:** [November 4, 2017, 3:10pm UTC](https://forum.getkirby.com/t/strange-bug-on-multilanguage-page-for-titles/8944/7 "2017-11-04T15:10:32Z")

</div>

1 problem at a time: headers first.

for the “services” page -\> Is the headline field filled in (== not empty) in the English version?

---

<div class="post-metadata">

**Author:** ![ToGe88](https://avatars.discourse-cdn.com/v4/letter/t/c68b51/32.png) [@ToGe88](https://forum.getkirby.com/u/ToGe88)\
**Post date:** [November 4, 2017, 3:26pm UTC](https://forum.getkirby.com/t/strange-bug-on-multilanguage-page-for-titles/8944/8 "2017-11-04T15:26:16Z")

</div>

Yes it is. And has been all the time…

---

<div class="post-metadata">

**Author:** ![bvdputte](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/bvdputte/32/8179_2.png) [@bvdputte](https://forum.getkirby.com/u/bvdputte)\
**Post date:** [November 4, 2017, 3:35pm UTC](https://forum.getkirby.com/t/strange-bug-on-multilanguage-page-for-titles/8944/9 "2017-11-04T15:35:50Z")

</div>

What is

```
var_dump($page->headline()->isNotEmpty());
var_dump($page->headline()->html());
var_dump($page->title());

```

for the English version of “services” ?

And is the filename correct? `services.en.md` or something?

---

<div class="post-metadata">

**Author:** ![ToGe88](https://avatars.discourse-cdn.com/v4/letter/t/c68b51/32.png) [@ToGe88](https://forum.getkirby.com/u/ToGe88)\
**Post date:** [November 4, 2017, 3:47pm UTC](https://forum.getkirby.com/t/strange-bug-on-multilanguage-page-for-titles/8944/10 "2017-11-04T15:47:56Z")

</div>

I cannot test it at the moment because I’m out. But the template is overview-page.php and the text file is overview-page.en.txt…

---

<div class="post-metadata">

**Author:** ![anon77445132](https://avatars.discourse-cdn.com/v4/letter/a/4da419/32.png) [@anon77445132](https://forum.getkirby.com/u/anon77445132)\
**Post date:** [November 4, 2017, 4:47pm UTC](https://forum.getkirby.com/t/strange-bug-on-multilanguage-page-for-titles/8944/11 "2017-11-04T16:47:52Z")

</div>

@ToGe88:  
And there is NO file like `overview-page.txt` (any `.txt` file without any language-code in it’s name) in your content directory?

---

<div class="post-metadata">

**Author:** ![ToGe88](https://avatars.discourse-cdn.com/v4/letter/t/c68b51/32.png) [@ToGe88](https://forum.getkirby.com/u/ToGe88)\
**Post date:** [November 4, 2017, 8:35pm UTC](https://forum.getkirby.com/t/strange-bug-on-multilanguage-page-for-titles/8944/12 "2017-11-04T20:35:47Z")

</div>

No there is not:

 ![image](https://europe1.discourse-cdn.com/flex017/uploads/getkirby/original/2X/2/2df91bf6a00d2f0f725eb5132d4781606b47ac90.png)

That’s what i thought at first and what i always check when something like this occurs…

---

<div class="post-metadata">

**Author:** ![ToGe88](https://avatars.discourse-cdn.com/v4/letter/t/c68b51/32.png) [@ToGe88](https://forum.getkirby.com/u/ToGe88)\
**Post date:** [November 4, 2017, 9:17pm UTC](https://forum.getkirby.com/t/strange-bug-on-multilanguage-page-for-titles/8944/13 "2017-11-04T21:17:12Z")

</div>

So first of all thank you for your support. The forum is helpful as always. But as i assumed, the problem was somewhere else. Yesterday i initialized the redirects plugin for simple 301 redirects: [https://gist.github.com/mogelbrod/5e5c64ff943ba6909ce3bd35a57bc808](https://gist.github.com/mogelbrod/5e5c64ff943ba6909ce3bd35a57bc808)

I removed this plugin and tada: functionality same as before.

Maybe someone knows why this happened, therefore i give you a screenshot from the backend with the redirects (Old URL on the left, new one on the right):

 ![image](https://europe1.discourse-cdn.com/flex017/uploads/getkirby/original/2X/8/80a8f08b3eacda43389a5236912985d1e7a1020e.png)

Thanks so far  
Tobi

---

<div class="post-metadata">

**Author:** ![texnixe](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/texnixe/32/5754_2.png) [@texnixe](https://forum.getkirby.com/u/texnixe)\
**Post date:** [November 4, 2017, 9:34pm UTC](https://forum.getkirby.com/t/strange-bug-on-multilanguage-page-for-titles/8944/14 "2017-11-04T21:34:04Z")

</div>

I had thought that there were some routes involved. I think the problem is that your new routes contain the language code.

---

<div class="post-metadata">

**Author:** ![ToGe88](https://avatars.discourse-cdn.com/v4/letter/t/c68b51/32.png) [@ToGe88](https://forum.getkirby.com/u/ToGe88)\
**Post date:** [November 4, 2017, 9:39pm UTC](https://forum.getkirby.com/t/strange-bug-on-multilanguage-page-for-titles/8944/15 "2017-11-04T21:39:07Z")

</div>

Hmmm and would be the best way to do this? Without the lang code?

---

<div class="post-metadata">

**Author:** ![texnixe](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/texnixe/32/5754_2.png) [@texnixe](https://forum.getkirby.com/u/texnixe)\
**Post date:** [November 4, 2017, 9:51pm UTC](https://forum.getkirby.com/t/strange-bug-on-multilanguage-page-for-titles/8944/16 "2017-11-04T21:51:36Z")

</div>

I’d try without the lang code, the way the new page is called in the route doesn’t make sense with the language code, or rather, the route would have to work differently. Otherwise I’d do this via the .htaccess or ideally via the server config file.

---

<div class="post-metadata">

**Author:** ![ToGe88](https://avatars.discourse-cdn.com/v4/letter/t/c68b51/32.png) [@ToGe88](https://forum.getkirby.com/u/ToGe88)\
**Post date:** [November 4, 2017, 10:32pm UTC](https://forum.getkirby.com/t/strange-bug-on-multilanguage-page-for-titles/8944/17 "2017-11-04T22:32:30Z")

</div>

So i tried it without the language code. That didn’t help. What’s the best way to do this with htaccess for Kirby?

---

<div class="post-metadata">

**Author:** ![texnixe](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/texnixe/32/5754_2.png) [@texnixe](https://forum.getkirby.com/u/texnixe)\
**Post date:** [November 4, 2017, 10:53pm UTC](https://forum.getkirby.com/t/strange-bug-on-multilanguage-page-for-titles/8944/18 "2017-11-04T22:53:58Z")

</div>

Here is an example from a httpd.conf file (you can use this in your .htaccess as well):

```auto
Redirect 301 "/referenzen.html" "/referenzen"
Redirect 301 "/Arbeit.html" "/leistungen"
Redirect 301 "/Kontakt.html" "/kontakt"
Redirect 301 "/wirueberuns.html" "/ueber-uns"
Redirect 301 "/Ansprechpartner.html" "/ueber-uns"
Redirect 301 "/leistungen.html" "/leistungen"
Redirect 301 "/Organisation.html" "/leistungen"
Redirect 301 "/kunden.html" "/referenzen"
Redirect 301 "/Impressum.html" "/impressum"
Redirect 301 "/jobs.html" "/"
Redirect 301 "/index.html" "/"
#RedirectMatch 301 "/(.+)\.html$" "/"

```

In your use case, you would use the new url **with** the language code though.

---

<div class="post-metadata">

**Author:** ![ToGe88](https://avatars.discourse-cdn.com/v4/letter/t/c68b51/32.png) [@ToGe88](https://forum.getkirby.com/u/ToGe88)\
**Post date:** [November 4, 2017, 11:42pm UTC](https://forum.getkirby.com/t/strange-bug-on-multilanguage-page-for-titles/8944/19 "2017-11-04T23:42:32Z")

</div>

O.K. I’m gonna give it a try tomorrow. Thanks so far. So you do think that this would solve this problem or would the error occur again?

Thanks Tobi

---

<div class="post-metadata">

**Author:** ![texnixe](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/texnixe/32/5754_2.png) [@texnixe](https://forum.getkirby.com/u/texnixe)\
**Post date:** [November 4, 2017, 11:45pm UTC](https://forum.getkirby.com/t/strange-bug-on-multilanguage-page-for-titles/8944/20 "2017-11-04T23:45:34Z")

</div>

I haven’t tested this with a multi-language site. I recommend that you test this on localhost or a dev server first before you deploy to production.

[Next page](https://forum.getkirby.com/t/strange-bug-on-multilanguage-page-for-titles/8944.md?page=2)
