Multi-language for only some pages

Hi there.

We have a German language website and we’d like to create a few new foreign language pages. The product owner doesn’t want to use the built-in multi-language feature because he’s afraid of getting dinged by google if we have every page “duplicated” into the five different languages we might use.

ie,,,, etc.

Instead we’re going to have a german website, with just four or five separate pages in the foreign languages. For example a /english page.

Right now I have the ‘languages’ option defined for just German.

But… I’m thinking that if english isn’t defined in the languages option, the new /english page isn’t going to work with l::get().

So, I’m kinda stuck, either implementing my own version of the L class, or having multiple versions of each page.

Anybody got any tips/suggestions in either problem?

Ideally, I’d just like to turn multi-language on and have kirby return 404 for any page that doesn’t exist in that language and not display the page in the sitemap. (I can work on that separately).

Have you checked ?

Had not seen that… It helps.

So it looks like I’ll need to adjust all my templates to redirect to my 404 page if there is no translation.
And I’ll need to see how the sitemap plugin handles multi-lang to filter out all the pages that I don’t want included.

Maybe it’s easier for you to implement some custom page method who does that, and use that in your templates?

Yeah, I did this: for the sitemap, and created a isTranslated() Page method for the pages:

// returns true if this page is translated for the requested URL
// and specified language.
page::$methods['isTranslated'] = function($page, $lang = null) {
    if ($lang === null) {
        $lang = site()->language();
    return $page->content($lang->code())->exists();

And made a small snippet that included (among other things):

if (!$page->isTranslated(site()->language()) && $page->intendedTemplate() !== 'error') {

You might as well do that in the header snippet instead of adding it to every template.