Last updated: 10/25/2021 ◌ First posted: 12/29/2014 ◌ 3 minute read
A client of mine, which I will anonymize by telling you that they’re a capybara life insurance company, uses a CMS that makes it impossible to generate an automated XML sitemap file. Or any XML sitemap file. Or any XML files at all…
Important Update: This post was originally published in 2014 and references the old Search Console (Google Webmaster Tools). I have not tested JSP sitemaps in the new Search Console. If you have, I’d love to hear about it.
After a large restructuring of the site, getting an XML sitemap to submit to Google Search Console became a priority for us. But the capybaras still couldn’t get around their CMS limitations.
We even manually created an XML sitemap file to upload, but the CMS locked it out of the root folder like a malevolent artificial intelligence.
While my next step was going to be creating a TXT sitemap, which is just a simple list of one URL per line, the capybaras had a different idea.
Their CMS allowed them free reign to create JSP (JavaServer Page) files. “We’ll just create the sitemap file in that!” they squeaked (as capybaras are prone to do).
That’s Not Gonna Work
JSP files are used to serve up various other types of pages. I usually see it for HTML, and in fact even made an ill-fated JSP-based portfolio back in my early dev days.
I knew that it could be used to serve other filetypes, including XML. But that didn’t make it an XML file itself.
Going to the capybara’s website /sitemap.xml was of course a 404 error page, and obviously the file could only be reached at /sitemap.jsp.
Viewing the source, it did indeed show up as a coded XML file, but again – still JSP in actual format:
Just in case, I checked with Google’s help file. Yup, the normal options here, nothing new:
I also checked with the Sitemaps.org official protocol. Same story again:
So I said, “Go ahead and try, capybaras, but it’s probably not going to work.”
It Didn’t Work
We submitted the file to Search Console on October 20th, and Search Console spat it back out, saying, “what the heck, this isn’t XML!”
It seemed like the story was over. But then…
Over two weeks later, with no further action on our part or anyone else’s, Google Search Console decided it wanted to accept it after all.
A quick test of it even confirms the “no errors found” message:
So it appears that serving an XML sitemap over a JSP file does indeed work, although it may take a few weeks to get it recognized.
It appears you can use JSP files for your XML sitemaps.
I can’t say I’d recommend it, since it took so long to be processed, and we haven’t yet tried to change it – I imagine that may take weeks more.
But if it’s truly your only option, it’s definitely better than nothing. It certainly worked for my capybaras.
My capybara clients told me they had read a source saying it worked, but failed to link us the source, and I couldn’t find one anywhere. So now I will become the source. If possible, I will try to send this page back in time for them to reference, and get into nice bootstrap paradox with my own blog.
Written By Ethan Hulbert