Two multi-language setup questions

Hello together. I’m struggling with my multi-language setup, maybe someone has had a similar problem/experience or a solution. I’m happy with all tips.

The default language is DE. Second language is EN. Not every DE page will have a EN version. For this case, I can filter by language.

BUT Some pages could only be in EN and not in the default language DE. I don’t want to work with two different “sitemaps”, because in both languages the pages are 80% the same.

#1 is there a solid way, how I can handle this?

#2 is there a way, how a panel user can delete only the EN version of a page?

THX!

1 Like

Hi and welcome to our forum.

No, that’s not possible (or at least not out of the box, but could be achieved with custom functionality), because deleting a page means deleting a folder with all files in it, while a translation is just another text file inside the page folder.

The default language version of the content text files is always created (when using the Panel), so there is really no way around it.

One way to handle this would maybe be through a toggle field that marks a language version as invalid, then you can filter by this criterium.

We came across a similar situation with a client that had a Blog in 2 different languages. In their Blog, some articles had to be available in both languages, but some articles were only relevant to visitors in language 1 or language 2.

We solved this by creating 3 different types of ‘Articles’:

  • Article - Multilingual
  • Article - Language 1
  • Article - Language 2

The ‘single-language’ articles were setup using the Panel View Extended plugin - which allows us to setup single-language content in a multilingual site.

Now, when the visitor is viewing the Blog in ‘language 1’, we show only the ‘language 1’ articles, plus the ‘multilingual’ articles - same for ‘language 2’. We are then also able to easily output appropriate sitemap info with language indicators for search engines, for all articles, in all languages.

Hi Sonja and thank you, both for your welcome and your quick help :slight_smile:

The toggle workaround could be a solution for me – not perfectly perfect but of course functional. Just to be clear: you mean a special file or a field? The delete-button vor language versions could be a nice extension to the toggle-workaround. Maybe i’ll dive into this later.

@kirbyzone Thank you for sharing your problem and solution! This is also a very interesting and in your case a very well workaround. I’m not quite sure, if this is also good for our project because we will have a lot of templates for different pages.

In your case, every type has 3 own blueprints? Am I right or did I miss something?

Sorry for the typo :see_no_evil:, I meant a field.

No sorries… first I thought I can’t follow you because i don’t know this “fancy toggle file” :upside_down_face:

@christianwalter yes, each ‘type’ would have 3 (or more) separate blueprints - depending on how many languages you wanted.

1 Like

@texnixe I think I’ll try the toggle way. The navigation already works for me. :partying_face:

Now I want to setup some seo stuff and language switching. In these cases I need to know, if a translation exists and if the toggle is false (or checked). Something like this – I know, it doesn’t work like this :slight_smile:

<?php foreach($kirby->languages() as $language): ?>
<?php if ($page->translation($language)->exists() AND $page->hide($language)->toBool() == false ): ?>
<link rel="alternate" hreflang="<?php echo $language->code() ?>" href="<?= $page->url($language->code()) ?>">
<?php endif ?>
<?php endforeach ?>

Should be:

$page->content($language->code())->hide()->toBool()

You can pass the language code to the content object.

Ah yes … exactly what I was searching for. Thank you for helping!