Support » Plugin: Yoast SEO » Sitemap Error : XML declaration allowed only at the start of the document

  • Resolved geco06

    (@geco06)


    Hi

    Please take a look here:
    https://www.lazegatte.fr/sitemap_index.xml

    I get this error message:
    This page contains the following errors:
    error on line 2 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.

    What could i do ?

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

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

    (@devnihil)

    We checked on your site’s sitemap and do see the page is generating an error of ‘XML declaration allowed only at the start of the document.’ We reviewed the source code of the page and found that the document does contain a whitespace for the first line of the file, which is what is causing the issue.
    ‚Äč
    The error ‘XML declaration allowed only at the start of the document’ is most often caused when another plugin or theme adds white space to the beginning of the sitemap file. You will need to view the source code of the sitemap_index.xml document in order to confirm this and we have additional information on this and how to resolve this error at the following link: https://kb.yoast.com/kb/xml-sitemap-error/

    However, this issue can also be caused by an empty line at the end of your theme’s functions.php file. If there is no empty line in this file, we highly recommend running a conflict check to identify what outputs the empty white space.

    In order to resolve this, we would first recommend clearing your site’s caching. If you are not sure how to clear your server caching, please speak with your host provider. Does clearing your caching from your caching plugin (W3TC, WP Supercache, etc), server (Varnish, LiteSpeed, or others), or CDN (such as Cloudflare, Amazon AWS, etc) resolve the issue?

    If after clearing your site’s cache you are still experiencing the error on the sitemap, we would then recommend performing a conflict check. You can sometimes experience functionality problems or unexpected behavior from the plugin due to plugin or theme conflicts. Can you confirm you have performed a complete plugin/theme conflict check by disabling other plugins, and resetting the theme to a default such as twentyseventeen? We have additional information on how to check for a conflict here: https://kb.yoast.com/kb/how-to-check-for-plugin-conflicts/

    Thank you!
    this issue is solved, it was a empty space at the beginning of function.php

    Plugin Support jerparx

    (@jerparx)

    Thanks for the update @geco06! We are glad to know the issue is now resolved!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Sitemap Error : XML declaration allowed only at the start of the document’ is closed to new replies.