Sitemap Error – XML Parsing Error: junk after document element

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.”

wordpress install plugin

Step 2

Click on “Settings” under the Disqus comment system plugin.

disqus comment system

Step 3

Scroll down a little bit and check the box next to “Output JavaScript in footer” and then click save.

disqus template conflicts

The problem should now be fixed! You might need to clear your cache to make sure it is working.

author bio
Brian Jackson

I craft actionable content and develop performance-driven WordPress plugins. Connect on X, subscribe to my newsletter (once a month), or buy me coffee.

1 thought on “Sitemap Error – XML Parsing Error: junk after document element”

  1. Pingback: موتور جستجوگر برای شما | مشکل در ایجاد سایت مپ با افزونه ی WordPress seo

Leave a Comment