Skip Navigation

This is the technical support forum for WPML - the multilingual WordPress plugin.

Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.

Our next available supporter will start replying to tickets in about 6.43 hours from now. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
- 8:00 – 13:00 9:00 – 13:00 9:00 – 13:00 8:00 – 12:00 8:00 – 12:00 -
- 14:00 – 17:00 14:00 – 18:00 14:00 – 18:00 13:00 – 17:00 13:00 – 17:00 -

Supporter timezone: Europe/Zagreb (GMT+02:00)

Tagged: 

This topic contains 7 replies, has 2 voices.

Last updated by Bruno Kos 3 days, 7 hours ago.

Assisted by: Bruno Kos.

Author Posts
September 19, 2024 at 10:00 am #16197619

dawidZ-5

Background of the issue:
I use the directory for the default language, and the SEO Framework adds this default language directory to all sitemaps links for the rest of the languages inside robots.txt. My robots.txt: Sitemap: hidden link Sitemap: hidden link Sitemap: hidden link Sitemap: hidden link Sitemap: hidden link Sitemap: hidden link Sitemap: hidden link Sitemap: hidden link Sitemap: hidden link Sitemap: hidden link Sitemap: hidden link Sitemap: hidden link

Symptoms:
The SEO Framework generates invalid URLs for the sitemap in robots.txt.

Questions:
Why is the SEO Framework adding the default language directory to all sitemap links?
How can I configure the SEO Framework to generate correct sitemap URLs for each language?

September 19, 2024 at 11:32 am #16198269

Bruno Kos
Supporter

Languages: English (English ) German (Deutsch ) French (Français )

Timezone: Europe/Zagreb (GMT+02:00)

Can you tell me if you see the issue here?
hidden link

Because this is what I get for sitemap URLs:
hidden link
hidden link

September 19, 2024 at 4:36 pm #16200282

dawidZ-5

Yes, the problem still exists,
hidden link
in the robots.txt file link to de language sitemap is incorrect
Sitemap: hidden link

there is added /en/ before /de/

There is no problem with generating the actual site map, there is a problem with adding the correct link to the site map in the robots.txt file for translated languages

September 20, 2024 at 8:52 am #16201687

Bruno Kos
Supporter

Languages: English (English ) German (Deutsch ) French (Français )

Timezone: Europe/Zagreb (GMT+02:00)

I escalated this case to our Compatibility team and will keep you posted.

September 24, 2024 at 12:51 pm #16215014

Bruno Kos
Supporter

Languages: English (English ) German (Deutsch ) French (Français )

Timezone: Europe/Zagreb (GMT+02:00)

Can you please try the following:

1. Open the `.../wp-content/plugins/autodescription/inc/classes/sitemap/registry.class.php` file.

2. Locate line 173.

3. Replace the following line:

  $path_info = static::get_sitemap_base_path_info();

With this updated code:

   $path_info = static::get_sitemap_base_path_info();

   // Workaround for compsupp-7598
   $wpml_language_directory = apply_filters('wpml_get_setting', false, 'urls')['directory_for_default_language'];
   if ( $id != 'base' AND $wpml_language_directory )  {
       $path_info['path'] = '/';
   }

Does it work?

September 25, 2024 at 9:10 am #16219174

dawidZ-5

Hi,
after updating this code sitemap.xml is returning 404

Zrzut ekranu 2024-09-25 110959.png
September 25, 2024 at 9:24 am #16219375

Bruno Kos
Supporter

Languages: English (English ) German (Deutsch ) French (Français )

Timezone: Europe/Zagreb (GMT+02:00)

Let me check this with Compatibility team.

September 26, 2024 at 11:26 am #16224742

Bruno Kos
Supporter

Languages: English (English ) German (Deutsch ) French (Français )

Timezone: Europe/Zagreb (GMT+02:00)

We’ve made a small adjustment to the workaround. Could you please try it again?

1. Open the file located at: `.../wp-content/plugins/autodescription/inc/classes/sitemap/registry.class.php`.
2. Locate line 173.
3. Replace the following line:

$path_info = static::get_sitemap_base_path_info();

With this:

$path_info = static::get_sitemap_base_path_info();

// Workaround for compsupp-7598
if ( $_SERVER['REQUEST_URI'] == 'https://cdn.wpml.org/robots.txt' ) {
    $wpml_language_directory = apply_filters('wpml_get_setting', false, 'urls')['directory_for_default_language'];
    if ( $id != 'base' && $wpml_language_directory && $list['base']['robots'] )  {
        $path_info['path'] = '/';
    }
}

Please note that this is just a temporary workaround. We'll still need input from the plugin author to implement a more comprehensive solution, as they are responsible for the compatibility updates.

Let me know if this works!