Wrong links in sitemap - URGENT

Hi,

I have launced a new website for a company, and I want it to be indexed. I have this code in my functions.php file:

image

But it does not change the urls of the sitemap:

https://backend.arctic-bioscience.com/sitemap_index.xml

Frontity is great, but the sitemap struggles really needs to be figured out!

Does anyone have any tips here? Still haven’t figured it out, and the site is live with a wrong sitemap.

Just a shot in the dark, not that familiar with this whole topic, but due to your urgency, just pointing out that there is a function wp_parse_url() (see wp_parse_url() | Function | WordPress Developer Resources) that seems to solve a bug in PHP’s parse_url that you are using. Hope that helps.

I have now switched the “add_filter” to “wpseo_sitemap_entry”, and it works on all links except the “main” link of the post type.

https://backend.arctic-bioscience.com/sitemap_index.xml

This is starting to get more urgent. The homepage of their site has now dissapeared from google.

Hi @kasper,

Have you checked this post?

There you have several solutions to have a proper sitemaps.xml accessible from your Frontity project.

Take also into account that you can use a robots.txt in your Frontity project to help crawlers detect main files of your project

Hope this helps

Hi @juanma,

The problem was that the yoast sitemap did not change the links of the “base” pages of each post type with the filter. And when I disabled the Yoast sitemap, I could not reach the core sitemap either. I found out now after a little research that if you disable the yoast sitemap, yoast also disables the core sitemap.

So I added this filter to the functions.php to activate it again:

add_filter( 'wp_sitemaps_enabled', '__return_true' );

And with that done, the core sitemap works, with the yoast sitemap deactivated. And the solution that @SantosGuillamot provided works for all the links in the core sitemap.

So now I have a sitemap that works. Thanks!

1 Like

I bumped into that one as well :grin:

My solution was to go to the Permalinks settings page and click on “Save” again.