Sitemap Error – XML Parsing error: junk after document element
If you are using Yoast or another sitemap plugin in WordPress and are also running the Disqus comment system plugin and are receiving the following error below then most likely it is due to the order in which the javascript is placed on your page. Usually this is because of a WordPress theme conflict.
XML Parsing Error: junk after document element Location: https://brianjackson.io/sitemap_index.xml Line Number 22, Column 1:<?xml version="1.0" encoding="UTF-8"?><?xml-stylesheet type="text/xsl" href="https://brianjackson.io/main-sitemap.xsl"?>
The problem is that the Disqus javascript is being outputted first which is causing the sitemap from Yoast to break. To fix this we simply need to check the option in the Disqus plugin settings to output the javascript in the footer. Follow the directions below.
Step 1
In the WordPress dashboard, click into “Plugins” and then “Installed Plugins.”
Step 2
Click on “Settings” under the Disqus comment system plugin.
Step 3
Scroll down a little bit and check the box next to “Output JavaScript in footer” and then click save.
The problem should now be fixed! You might need to clear your cache to make sure it is working.
1 thought on “Sitemap Error – XML Parsing Error: junk after document element”