tobimori / kirby-seo

🔎 All-in-one toolkit that makes implementing SEO & Meta best practices in your Kirby 4+ site a breeze
https://plugins.andkindness.com/seo
MIT License
85 stars 13 forks source link

Multi language: Pages translated only for some languages #104

Open wdebusschere opened 4 months ago

wdebusschere commented 4 months ago

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.

tobimori commented 4 months ago

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

wdebusschere commented 4 months ago

@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..

tobimori commented 4 months ago

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

wdebusschere commented 4 months ago

@tobimori can you elaborate?

tobimori commented 4 months ago

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

wdebusschere commented 4 months ago

@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..

tobimori commented 4 months ago

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

wdebusschere commented 4 months ago

@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 commented 4 months ago

@tobimori Any update on this?

tobimori commented 4 months ago

nope, let me re-open

wdebusschere commented 4 months ago

@tobimori Can you simulate it?

tobimori commented 4 months ago

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

wdebusschere commented 4 months ago

Any timing from your side?

tobimori commented 4 months ago

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