Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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!
Comment | File | Size | Author |
---|---|---|---|
#16 | Sitemap file-sitemap.xml-page-1-0.png | 32.91 KB | mattking5000 |
Comments
Comment #1
Anonymous (not verified) CreditAttribution: Anonymous commentedDid 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?
Comment #2
Dylan. CreditAttribution: Dylan. commentedOops.
Comment #3
Dylan. CreditAttribution: Dylan. commentedI 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.
Comment #4
ninonoscar CreditAttribution: ninonoscar commentedI 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
Comment #5
Dylan. CreditAttribution: Dylan. commentedDid you find a solution, ninonoscar? Since apparently nobody else does..
Comment #8
Dave ReidFor 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.
Comment #9
gillarf CreditAttribution: gillarf commentedi'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.
Comment #10
gillarf CreditAttribution: gillarf commentedi disabled the stylesheet, and it works fine.
This is still a bug though.
Comment #11
Anonymous (not verified) CreditAttribution: Anonymous commentedYou need to find the problem in your environment that is causing the empty line. We cannot reproduce the issue.
Comment #12
gillarf CreditAttribution: gillarf commentedThanks - where would I start? by turning modules off and on? Or is there a better way to debug issues like this?
Comment #13
Anonymous (not verified) CreditAttribution: Anonymous commentedIf 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.
Comment #14
DFS CreditAttribution: DFS commentedsitemap.xml - blank page
sitemap.xsl
Comment #15
cas.priyanka CreditAttribution: cas.priyanka commentedI am facing the same issue from 2-3 days , Need help....
Thank you in advanced.
Comment #16
mattking5000 CreditAttribution: mattking5000 commentedSame 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.
Comment #17
tsmulugeta CreditAttribution: tsmulugeta commentedHi 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!
Comment #18
tinokreutzer CreditAttribution: tinokreutzer commentedtsmulugeta's solution worked for me. Deleted extra line breaks after the php closing tag in my template.php.
Comment #19
jmeyerson CreditAttribution: jmeyerson commentedRESOLVED (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:
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...
Comment #20
Jawi CreditAttribution: Jawi commentedI'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.
Comment #21
nesreb CreditAttribution: nesreb as a volunteer commentedThis 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.
Comment #22
michaellenahan CreditAttribution: michaellenahan at erdfisch commentedSince 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!)
Comment #23
Anonymous (not verified) CreditAttribution: Anonymous as a volunteer and commented06-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.
Comment #24
vishal.shirguppi CreditAttribution: vishal.shirguppi commented# 17 worked for me.
Comment #25
salah2020 CreditAttribution: salah2020 commented@jmeyerson #19 worked grate..thank you ;)
Comment #26
washburn CreditAttribution: washburn as a volunteer commentedI 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.
Comment #27
localnetwork CreditAttribution: localnetwork as a volunteer and commented#19 Worked for me
Comment #28
mayap CreditAttribution: mayap commented@jmeyerson this worked for me as well, thank you! Removed the line from the D8 module
Comment #29
mralexho CreditAttribution: mralexho commentedLove 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.
Comment #30
gillarf CreditAttribution: gillarf commentedFor me, the https://www.domain.com/sitemap.xml version of the sitemap works but the https://domain.com/sitemap.xml doesn't.
Comment #31
PhilYHello,
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).
Comment #32
bramvandenbulcke CreditAttribution: bramvandenbulcke commentedSame 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)!
Comment #33
Morten-H CreditAttribution: Morten-H as a volunteer commentedHaving 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."
Comment #34
karaoglanoglou CreditAttribution: karaoglanoglou commented#23 fixed this for me, but only after rebuilding the links.
Comment #35
mrgoodfellow CreditAttribution: mrgoodfellow commentedI 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.
Comment #36
vrwired CreditAttribution: vrwired commentedOn 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.
Comment #37
rescandon CreditAttribution: rescandon at Four Kitchens commentedIf 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.
Comment #38
paul_leclerc CreditAttribution: paul_leclerc commentedI'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 :
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