Support » Plugin: Yoast SEO » Duplicate page in sitemap

  • Resolved CGItaly s.r.l.

    (@consultingroupitaly)


    The page https://www.consultingroupitaly.com/news/ appears in both post-sitemap.xml and page-sitemap.xml (the first without modification date and the last with modification date).

    Why it does appears 2 times?

    The page I need help with: [log in to see the link]

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Support devnihil

    (@devnihil)

    If you are experiencing an issue with duplicate URLs in the sitemap, you can force a cache reset of the sitemap by temporarily disabling the sitemap feature, and then re-enabling. To do so please perform the following steps:

      ​In WordPress go to SEO>General>Features
      ​For ‘XML Sitemaps’ Toggle the switch to ‘Disabled.’
      ​​Click ‘Save Changes.’
      ​Toggle the switch back to ‘Enabled.’
      ​Click ‘Save Changes.’

    ​We also have a guide on how to enable/disable XML Sitemaps here: https://kb.yoast.com/kb/enable-xml-sitemaps-in-the-wordpress-seo-plugin/. Can you please try the aforementioned suggestions and letting us know whether it resolves your issue and the duplicate URL is removed from the sitemap?

    Thread Starter CGItaly s.r.l.

    (@consultingroupitaly)

    @devnihil
    I have done it now, the problem remains.

    It’s because /news is set as “posts page”. It’s expected behavior in this case. You could read more details on https://github.com/Yoast/wordpress-seo/issues/10994#issuecomment-436201395

    Thread Starter CGItaly s.r.l.

    (@consultingroupitaly)

    Couldn’t Yoast simply compare URL and detect it is the same?

    It needs some changes in the code to we could fix it. My personal opinion is that it should be excluded from page sitemap (because it’s post archive URL) and you can use filter wpseo_exclude_from_sitemap_by_post_ids to remove it from page-sitemap.xml.

    Example:

    add_filter( 'wpseo_exclude_from_sitemap_by_post_ids', 'my_sitemap_excludes' );
    
    function my_sitemap_excludes( $pages ) {
    	$pages[] = get_option( 'page_for_posts' );
    	return $pages;
    }
    
    Thread Starter CGItaly s.r.l.

    (@consultingroupitaly)

    @stodorovic: Thanks, it works but now how fix the problem of missing “Last modified” date?

    See here: https://www.consultingroupitaly.com/post-sitemap.xml

    PR 11443 fixes it. You could get updated class-post-type-sitemap-provider.php from this PR which populates “Last modified” date from the newest post.
    I’m working on PR which will fix duplicate URLs. I think that will be fixed in next releases of Yoast SEO.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Duplicate page in sitemap’ is closed to new replies.