Yoast / wordpress-seo

Yoast SEO for WordPress
https://yoast.com/wordpress/plugins/seo/
Other
1.77k stars 891 forks source link

[Feature Request] Make Yoast SEO Breadcrumbs Translatable with Polylang and WPML #7300

Open Pcosta88 opened 7 years ago

Pcosta88 commented 7 years ago

The Yoast SEO Premium Breadcrumbs are not translatable.

1.Add Yoast SEO Premium Breadcrumbs

screen shot 2017-06-23 at 10 33 09 am

2.With PolyLang Create a post in Spanish

screen shot 2017-06-23 at 10 28 21 am

3.See on frontend that breadcrumbs such as Home not translated

1

4.With WPML create a post in Dutch

screen shot 2017-06-23 at 10 43 23 am

4.See on FrontEnd that Breadcrumbs such as Home not translated screen_shot_2017-06-23_at_10_40_39_am

We should make them translatable.

NOTE: 1. The categories that appear in the breadcrumb pathway can be configured in the SEO-Advanced-Breadcrumb section.

screen shot 2017-06-23 at 10 44 40 am

2. To make the categories appear as "translated" you would need to create the categories in that language on the backend.

3.However, "home" should be translated.

Specs WordPress: 4.8 Yoast: 4.8 Polylang 2.1.5 WPML: 3.5.3.1

Pcosta88 commented 7 years ago

related: https://github.com/Yoast/wordpress-seo/issues/979

Pcosta88 commented 7 years ago

related: https://wpml.org/forums/topic/wp-seo-yoast-breadcrumbs-problem-with-wpml

Pcosta88 commented 7 years ago

Please inform the customer of conversation # 204026 when this conversation has been closed.

Pcosta88 commented 5 years ago

Please inform the customer of conversation # 492734 when this conversation has been closed.

soulstyle commented 5 years ago

Is there any updates on this, the referenced WPML support thread was started 5 years ago!

We are having this problem on multiple client sites and is, therefore, getting bug reports about this at least every second month.

Djennez commented 5 years ago

This does not have our immediate attention or priority to implement. We do welcome any attempt to add this as a functionality through a PR.

Pcosta88 commented 5 years ago

Please inform the customer of conversation # 513594 when this conversation has been closed.

Pcosta88 commented 4 years ago

Please inform the customer of conversation # 581186 when this conversation has been closed.

webprom commented 4 years ago

after updating to yoast 14.2 i have different languages breadcrumbs with wrong translations, it was ok before the update. tried with multilanguage yoast plugin and without it. using suggested xml:

<wpml-config>
    <admin-texts>
        <key name="wpseo_titles">
            <key name="breadcrumbs-404crumb"/>
            <key name="breadcrumbs-archiveprefix"/>
            <key name="breadcrumbs-home"/>
            <key name="breadcrumbs-prefix"/>
            <key name="breadcrumbs-searchprefix"/>
            <key name="breadcrumbs-sep"/></key>
    </admin-texts>
</wpml-config>

Any ideas? Can it be fixed?
mmikhan commented 4 years ago

+1 https://wordpress.org/support/topic/breadcrumb-home-link-not-working-right/

maybellyne commented 1 year ago

+1 https://wordpress.org/support/topic/yoast-and-polylang-how-to-translate-breadcrumbs-title/

IgorSan1986 commented 12 months ago

Same problem, breadcrumbs from custom post-type do not translate

ehnsio commented 6 months ago

Using polylang and having the same issue, would be a nice feature. I did a workaround to fetch the page title and url of the translated page in the correct current language.

function replace_lang_breadcrumbs($crumbs)
{
    // Get the last breadcrumb
    $last_crumb = end($crumbs);

    // Extract language code from the last breadcrumb URL
    preg_match('/\/([a-zA-Z\-_]+)\//', $last_crumb['url'], $matches);
    $current_language = isset($matches[1]) ? $matches[1] : '';

    foreach ($crumbs as $index => $crumb) {
        // Check if the breadcrumb corresponds to the current language
        if (!pll_is_translated_post_type($crumb['id'])) {
            // Get the translation of the page using the ID
            $translated_post_id = pll_get_post($crumb['id'], $current_language);
            if ($translated_post_id) {
                // Get the translated post title and permalink
                $translated_post_title = get_the_title($translated_post_id);
                $translated_post_permalink = get_permalink($translated_post_id);

                // Replace the breadcrumb with the translated post title and permalink
                $crumbs[$index]['url'] = $translated_post_permalink;
                $crumbs[$index]['text'] = $translated_post_title;
            }
        }
    }
    return $crumbs;
}

add_filter('wpseo_breadcrumb_links', 'replace_lang_breadcrumbs', 10, 1);