Hi,

I've been trying to get a sitemap set up for a website that was just recently launched. Once I installed the module and set links, I visited the sitemap page only to see it was blank (see here: http://buterbaughandhandlin.com/sitemap.xml). When I inspect the page, the only thing visible is "xml-stylesheet". Is the normally the way it is supposed to be?

Any help is appreciated!

Thanks!

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Anonymous’s picture

Category: bug » support
Status: Active » Postponed (maintainer needs more info)

Did you go to the content type administration pages and enable xmlsitemap for each type you want included in the sitemap? Do you have your crontab setup?

Dylan.’s picture

Oops.

Dylan.’s picture

I have done the former. On the XML Sitemap configuration page, it says I have 18 links, and 1 page included. So I assumed nothing was wrong with the inclusion of the links. What do you mean about crontab? I have ran cron, updated the cached files for the sitemap, and rebuilt the links.

ninonoscar’s picture

I have exactly the same problem, tried to reinstall all after cleaning the cach and the files, and my xml site map has always only one link, but the "human file" seems good... prehaps it's because i realize my works in localhost (wamp installation) before export my work on my real servor? thanks for any help

Dylan.’s picture

Did you find a solution, ninonoscar? Since apparently nobody else does..

Dave Reid’s picture

For some reason your XSL file (http://buterbaughandhandlin.com/sitemap.xsl) is being output with an empty line at the beginning of it, which fails XML validation. I cannot confirm the problem with the latest code.

gillarf’s picture

i'm having the same issue, and my xsl file has an empty first line also.

http://www.travellingsnail.com/sitemap.xml

Also, lots of jquery errors.

gillarf’s picture

i disabled the stylesheet, and it works fine.

This is still a bug though.

Anonymous’s picture

You need to find the problem in your environment that is causing the empty line. We cannot reproduce the issue.

gillarf’s picture

Thanks - where would I start? by turning modules off and on? Or is there a better way to debug issues like this?

Anonymous’s picture

If you have a development version, turn them off and on and emptying cache between each iteration may be good enough. Using regular expressions to search through the files in you modules directory may be another method.

DFS’s picture

sitemap.xml - blank page
sitemap.xsl

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.
BLANK LINE
<?xml version="1.0" encoding="UTF-8"?>

<!-- Copyright (c) 2010  Dave Reid <http://drupal.org/user/53892>
cas.priyanka’s picture

I am facing the same issue from 2-3 days , Need help....

Thank you in advanced.

mattking5000’s picture

Same problem here, configured the sitemap to what I needed, ran the update, have ~9K items and XML Sitemap says I have two pages of sitemaps. But clicking on the pages does not show the sitemap, just links to the pages again.

tsmulugeta’s picture

Hi All,

A SOLUTION THAT WORKED FOR ME (I have a Drupal 7 website) is to open your template.php file (which should be located at sites/all/themes/your_theme_name/template.php) and deleting lines after the closing tags. I also deleted extra lines before the opening tag <?php

This worked for me. I would it helps you too!

tinokreutzer’s picture

tsmulugeta's solution worked for me. Deleted extra line breaks after the php closing tag in my template.php.

jmeyerson’s picture

RESOLVED (for me):

I had no extra linebreaks after the closting PHP tags in my theme, but I was still running into the same issue.

Working on a Mac, opening my "/sitemap.xml" in Chrome & Safari was displaying nothing.

Opening in Firefox gave this error:

XML Parsing Error: XML or text declaration not at start of entity
Location: http://MYSITE/sitemap.xsl
Line Number 3, Column 1:<?xml version="1.0" encoding="UTF-8"?>
^

Going into /modules/xmlsitemap/xsl/xmlsitemap.xsl, I removed this code from the top:
<?xml version="1.0" encoding="UTF-8"?>
and the content displays in all my browsers.

As a relatively new developer, I'm not sure of the implications of removing that code, but it seems to be working now...

Jawi’s picture

Version: 7.x-2.0-beta3 » 7.x-2.0-rc2
Category: Support request » Bug report
Priority: Normal » Major
Issue summary: View changes
Issue tags: +empty xml sitemap, +blanc sitemap

I'm having the same issue. With multilingual sites with multi domains, the sitemaps are blank. Commenting out the first line ( <?xml version="1.0" encoding="UTF-8"?> ) at file /modules/xmlsitemap/xsl/xmlsitemap.xsl as discribed at #19 does not solve this issue in my case. Using the sitemap settings without the stylesheet enclosed does print a correct sitmap.xml file.

Please investigate this issue with the xmlsitemap module on multilingual and multidomain sites.

nesreb’s picture

This is a really old post, but we just encountered the same symptoms described by the op. The steps in this post helped us identify the culprit. There was a blank line at the beginning of a module we recently created.

https://www.drupal.org/node/175137#comment-1526410

Hope this helps somebody.

michaellenahan’s picture

Since this is currently the first hit in Google for "drupal XML declaration allowed only at the start of the document":

Please check if you have:
$conf['theme_debug'] = TRUE;
... in your settings.php, and comment it out.

This adds extra comments to your theme output. If you are using the theme system to create xml files, these xml files will not have a good structure!

(Apologies to the xmlsitemap team for hijacking this issue!)

Anonymous’s picture

06-05-2015 Update:
- Go to XML sitemap module's SETTINGS tab, i.e. /admin/config/search/xmlsitemap/settings.
- Check "Include a stylesheet in the sitemaps for humans.":
If ON (checked), sitemap will be BLANK/FAIL to generate.
If OFF (not checked), sitemap is generated and displayed at http://yourdomain-url/sitemap.xml.

vishal.shirguppi’s picture

# 17 worked for me.

salah2020’s picture

@jmeyerson #19 worked grate..thank you ;)

washburn’s picture

I encountered this problem today using XML sitemap 7.x-2.3

The page was showing all white.
On - admin/config/search/xmlsitemap
"List" tab showed over 1100 links.

In the browser while on the sitemap.xml url I opted to show page source and all of the goods were there.
I unchecked "Include a stylesheet in the sitemaps for humans." on admin/config/search/xmlsitemap/settings
I now get a visible page but it is not compact for simple viewing.

To understand further, I added the stylesheet option again and looked at the source of the page that showed all white.
I looked into the sitemap.xsl page and saw the error in generating the stylesheet.
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.

localnetwork’s picture

#19 Worked for me

mayap’s picture

@jmeyerson this worked for me as well, thank you! Removed the line from the D8 module

mralexho’s picture

Love that this ticket is still open. We recently had to migrate a 7-year old D7 site and this module would not generate any XML.

#23 Unchecking the stylesheet option fixes the problem. Thanks @eamen.

gillarf’s picture

For me, the https://www.domain.com/sitemap.xml version of the sitemap works but the https://domain.com/sitemap.xml doesn't.

PhilY’s picture

Hello,

Same problem here with Drupal 7.59 and xmlsitemap 2.4 (using https on a French website).

Among suggested solutions from this issue, some work, other don't:
#17 (removing extra lines breaks): doesn't work (template.php file has been edited on a Mac)
#19 (removing/commenting <?xml version="1.0" encoding="UTF-8"?> from sitemap.xsl file): works
#20 (disable stylesheet for humans): works

So, in my case, I would say this is related to sitemap.xsl usage, either by the module (stylesheet to be disabled) or by the browser (1st line of sitemap.xsl to be deleted/commented).

bramvandenbulcke’s picture

Same here on an older website with Drupal 7.59 and XML Sitemap 2.4 with main language Dutch (with a multilingual setup: i18n is enabled).

Unchecking 'Include a stylesheet in the sitemaps for humans' was the key (see #20)!

Morten-H’s picture

Having the same issue with an older website using drupal 7.59 and xml sitemap 2.5.

#23 fixed it, unchecking "Include a stylesheet in the sitemaps for humans."

karaoglanoglou’s picture

#23 fixed this for me, but only after rebuilding the links.

mrgoodfellow’s picture

I have seen an issue if the configuration settings are not set in:
admin/config/search/xmlsitemap/settings
under "Advanced" -> Default base URL:
Make sure the default URL is set correctly.

If it is not set correctly, I get issues with the XML template being loaded correctly in Chrome and Firefox (seems to work in IE when this is set wrong)

I do have to rebuild the site-map once the correct base URL is set for the sitemap template to appear.

vrwired’s picture

On D8 with twig debug on and Internationalization installed, I anticipated trying #23 first may not work but it did work without needing troubleshoot either of other two suspects. I also needed to rebuild links before seeing /sitemap.xml take affect.

rescandon’s picture

If unchecking the option "Include a stylesheet in the sitemaps for humans." (/admin/config/search/xmlsitemap/settings) works on your site, the issue could be on any of the files in the theme, not only in the template.php

You can open the theme files and find the extra lines:
- Delete lines after the closing tags.
- Delete extra lines before the opening tag <?php

Save the files and enable the option "Include a stylesheet in the sitemaps for humans."
This solved the issue for us.

paul_leclerc’s picture

I'm not sure that this problem is caused by xmlsitemap in my case.
Unchecking the option "Include a stylesheet in the sitemaps for humans." indeed works but it's just a patch of a bigger problem as the url generated were based on the http protocol and not the https.

That's why I had this error in my console :

sitemap.xml:2 Unsafe attempt to load URL http://xxxx/sitemap.xsl from frame with URL http://xxxx/sitemap.xml. Domains, protocols and ports must match.

If you are using a drush command to complete your cron or xmlsitemap:regenerate,
xmlsitemap's code will return a 'http' scheme to construct the xsl url.

To make the whole system to work with https protocol, you can simply add the uri param to the command.

drush xmlsitemap:regenerate --uri=https://xxxxxxxxxx

That's a reason why the xml rebuild works with the admin interface and not with the drush rebuild.

®DL