• Resolved iva12

    (@iva12)


    My homepage shows up in the post and page sitemaps. The home page is set to show the latest posts in WordPress.

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

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

    (@devnihil)

    @iva12 This behavior is caused due to how WordPress sets the ‘Posts page’. When you set ‘Posts page’ in WordPress under Settings>Reading, then WordPress uses the same URL for two different page types. You can read more information about this here: https://github.com/Yoast/wordpress-seo/issues/10994#issuecomment-436201395

    As for how to resolve it, we’d recommend manually removing one instance of the URL from the page-sitemap.xml using a developer filter such as in the following code 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;
    }
    Plugin Support devnihil

    (@devnihil)

    We are going ahead and marking this issue as resolved due to inactivity. If you require any further assistance please create a new issue.

    Thread Starter iva12

    (@iva12)

    I have that code in my functions.php file already but still same issue.

    Sa?a

    (@stodorovic)

    It’s expected behavior. Page sitemap always includes home page and there isn’t a way to you exclude it. Post sitemap includes post archive as first link.

    @devhill This code doesn’t make any difference. Posts page is excluded by default from page sitemap.

    @iva12 It’s only cosmetic issue. You can use the filter wpseo_sitemap_post_type_archive_link to exclude archive page from post sitemap.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Homepage shows up in post and page sitemap’ is closed to new replies.