kirby-seo icon indicating copy to clipboard operation
kirby-seo copied to clipboard

Multi language: Pages translated only for some languages

Open wdebusschere opened this issue 1 year ago • 14 comments
trafficstars

Main language: EN, Other languages: FR, NL => NL is We have a multi language setup and we use an extra toggle field to set the page published or not.

What would be the best way to tune this to work for the plugin. Example English page Projects, only exists in EN, not in the other language.. (content is not translated), but the plugin will automatically create the rel="alternate" for each language and also in the sitemap.

wdebusschere avatar Jul 12 '24 14:07 wdebusschere

Return ['robotsIndex' => false] from the computed content: https://plugins.andkindness.com/seo/docs/advanced/computed if the language is unpublished.

tobimori avatar Jul 12 '24 14:07 tobimori

@tobimori We tried that, but it doesn't work because the $lang is always NULL. public function metaDefaults(string $lang = null): array dump the $lang it's always NULL..

wdebusschere avatar Jul 15 '24 09:07 wdebusschere

Try this instead: https://getkirby.com/docs/reference/objects/cms/languages/current

tobimori avatar Jul 15 '24 10:07 tobimori

@tobimori can you elaborate?

wdebusschere avatar Jul 15 '24 10:07 wdebusschere

Try kirby()->languages()->current() instead

tobimori avatar Jul 15 '24 10:07 tobimori

@tobimori no luck with this.. does this work for you? I see in our other sites that in the custom models the language is never passed, used..

wdebusschere avatar Jul 15 '24 10:07 wdebusschere

Does kirby()->language()->code() work?

tobimori avatar Jul 15 '24 10:07 tobimori

@tobimori

kirby()->language()->code() gives the active language code, but this is not enough Example we create a templatePage. English page Services has the boolean Published true Dutch page Services has the boolean Published false. The sitemap will onlyuse the default language of the templatePage The same for the alternate urls, in english it gives them all (does not check for each language the template)

<link href="https://www.domain.be/cs/services" hreflang="cs" rel="alternate">
<link href="https://www.domain.be/en/services" hreflang="en" rel="alternate">
<link href="https://www.domain.be/nl/services" hreflang="nl" rel="alternate"> => Should not be here
<link href="https://www.domain.be/en/services" hreflang="x-default" rel="alternate">

In dutch no alternate links..

wdebusschere avatar Jul 15 '24 11:07 wdebusschere

@tobimori Any update on this?

wdebusschere avatar Jul 16 '24 13:07 wdebusschere

nope, let me re-open

tobimori avatar Jul 16 '24 13:07 tobimori

@tobimori Can you simulate it?

wdebusschere avatar Jul 16 '24 13:07 wdebusschere

It needs changes to the plugin and is currently not possible.

tobimori avatar Jul 16 '24 13:07 tobimori

Any timing from your side?

wdebusschere avatar Jul 16 '24 13:07 wdebusschere

No time to work on this in the near future except if development is funded, too much client work right now.

tobimori avatar Jul 16 '24 13:07 tobimori