sitemap_index.html is invalid

#1115000
  • Brad Butlley
    Rank Math free

    Having this error in my sitemap page:
    https://medsurgbanks.com/sitemap_index.xml

    This page contains the following errors:
    error on line 6 at column 6: XML declaration allowed only at the start of the document
    Below is a rendering of the page up to the first error.

    When I view page source, I see this on line 1:
    <?xml version=”1.0″ encoding=”UTF-8″?><?xml-stylesheet type=”text/xsl” href=”//medsurgbanks.com/main-sitemap.xsl”?>

    The XSL stylesheet declaration is on the SAME LINE as the XML declaration, which breaks XML validation.

    I’ve tried:
    – Adding filter: add_filter(‘rank_math/sitemap/enable_xsl’, ‘__return_false’); in functions.php
    – Flushing permalinks multiple times
    – Clearing Rank Math cache
    – Checking for plugin conflicts
    – Nothing works

    The sitemap is being rejected by XML validators and may affect Google Search Console indexing.

    Please advise how to fix this issue or disable the XSL stylesheet properly.

    Thank you!

Viewing 2 replies - 1 through 2 (of 2 total)
  • Hello,

    We apologize for the issue you are facing with your sitemap. The error you are encountering indicates that there is a problem with the XML declaration due to the XSL stylesheet declaration being on the same line. This can indeed cause validation issues and affect indexing in Google Search Console.

    To resolve this issue, you can try the following steps:

    1. Check for Whitespace: Ensure that there are no blank lines or spaces before the `

    Sources:
    Rank Math Sitemap Issues and Their Fixes » Rank Math
    Why the Sitemap_Index.xml is Throwing a 404 Error » Rank Math

    This is an automated reply from Rank Math Support Bot. Your ticket has been assigned to a human agent and we will get back to you shortly.

    Hello,

    The most common reason for this error is a whitespace in your theme code, such as a blank line or space in your wp-config.php file or your theme’s functions.php file. This can happen when you edit these files manually or use a plugin or theme that modifies them.

    To fix this error, you need to find and remove the whitespace from your theme code.

    If the issue persists, you can also use this script to automatically fix this error: https://wejn.org/stuff/wejnswpwhitespacefix.php.html

    Looking forward to helping you.

Viewing 2 replies - 1 through 2 (of 2 total)

You must be logged in to reply to this ticket.