Related: #803756: No XML sitemaps available - There are currently no XML sitemap contexts available.

When first adding a sitemap after upgrade to 2.x, the UI shows this message at admin/settings/xmlsitemap/add -

"There are currently no XML sitemap contexts available"

[ Save ] Cancel

This is confusing to the user, because as stated in issue linked above, it's not actually an error message, and the correct action is to press "Save" which will generate a new sitemap.

Likewise, once I have a working sitemap visible at admin/settings/xmlsitemap, clicking edit on the sitemap shows the same message.

Either something has not gone right with the upgrade (plausible, and I can test this as I have a backup I can restore to a dev copy if that's helpful Dave), or the UI needs some loving there (clue me in to what's supposed to be happening and I can provide a patch to make it make sense). Or both :)

Comments

xurizaemon’s picture

To clarify why I've opened a separate issue: the other has devolved into a fairly lengthy support thread, but I'd like this issue just to get the UI to make sense for upgraders.

It might be as simple as updating the form to replace the "Save" button with "Add" if there are no XML site map contexts available, so people don't go rushing off to install Contexts module instead of clicking the button.

Can someone familiar with the module's workings please explain what the message is supposed to mean, so we can focus on making the UI more meaningful there?

Dave Reid’s picture

It might be hard to find in the other issue, so let me try and summarize:

Sitemap context = a property that distinguishes a sitemap from another. For example, if you're using the domain_xmlsitemap module, it provides a 'domain' context. The xmlsitemap_i18n sub-module provides a 'language' context. If you just have the base install, there are no contexts to pick from. And you just get one base XML sitemap with no context. I need to improve this message somehow, because nothing is wrong. If you try and add another sitemap when one already exists and there's no contexts to pick from, it will tell you, "hey, there's already a sitemap with this same context (i.e. no context)" and not allow you to save it.

xurizaemon’s picture

Ok. After a short discussion in IRC, the issue was that on visiting admin/settings/xmlsitemap, no default sitemap was generated.

This meant that I clicked through to add a Sitemap Context, which (somehow) resulted in the generation of a default sitemap, but confused me because I didn't have (or need) any context-providing modules installed.

I will dig into this and see how it can be improved. Thanks Dave for the discussion.

willmoy’s picture

Assuming a sitemap is created for the default context automatically, as it is on a new install, then surely the right solution to the confusing error message is to hide both the add and the edit links unless there is a context available?

miaoulafrite’s picture

i'm also very confused

i would like to have 2 different sitemaps: one for the general infos of the site, and another for ONLY one kind of content (videos)

would that be possible?
how?

willmoy’s picture

miaoulafrite’s picture

thanks willmoy, so why is there this option "add a sitemap"
what does that mean if we cannot have different sitemaps?

AlexisWilke’s picture

grobot,

There is a bug in the upgrade. Just that one... It doesn't create the XML sitemap properly and you end up having to create it.

I also read that very same message as an error the first time and ended up creating all the XML sitemaps by hand (with an INSERT INTO statement).

I talked about it here: #978398: Upgrade from 1.x to 2.x

Today I was successful at getting a new site to work with XML sitemap using the Add + Save.

The Save button is also used when you edit the XML sitemap.

I'm not too sure I understand the context, but my guess is that depending on the context the XML sitemap has a specific name (you do not have a choice on that name if I'm correct, and you cannot create a custom sitemap with just a specific set of nodes.)

Thank you.
Alexis Wilke

willmoy’s picture

miaoulafrite: sorry I forgot to respond to this. At the moment the only different sitemaps you can have (as I understand it) are language specific or subdomain specific ones, with the respective modules.

You only ever need one sitemap at a time (or I can't think of a situation where that isn't true). The module will handle splitting into files appropriately for you, so you don't need to think about.

There is no support yet for e.g. news, mobile etc. sitemaps.

AlexisWilke’s picture

willmoy,

Speaking of the splitting, the main XML sitemap settings says "Pages" which I find very confusing. It should be "Chunks" as defined in the sitemap documentation. Plus, Pages can easily be interpreted as the node of type page.

Thank you.
Alexis

davycw’s picture

this same thing just happened to me in the 7 dev version.. can't find any way around it.

edit: i forgot to mention that i upgraded from the 7 beta that was released on april 29th, and ran the update script.

bitshift’s picture

Version: 6.x-2.x-dev » 7.x-2.x-dev

I am still getting the message "There are currently no XML sitemap contexts available". As of yesterday I was using the 7.x beta version, but have just now started using the 7.x dev build and still getting this message when I try to edit the settings.

Also, tried:
- delete generate folder in sites/default/files/xmlsitemap
- add a new xml sitemap, click the "update" button for updating cached files

However, it looks like an xml file gets created, but there is only 1 page in the sitemap? Also, I still get the message about "no xml sitemap contexts" when trying to edit.

Any suggestions ?

AlexisWilke’s picture

bitshift,

Check your Content types, it's probably Off by default.

Thank you.
Alexis Wilke

bitshift’s picture

Under content types
Home » Administration » Structure

I have only two at the moment - article and page.
Should I be seeing something for xml sitemap here?

Also, what do you mean by "off by default"?
If your referring to the sub-module "XML sitemap node" then ok, and yes, its turned on.

Anonymous’s picture

No, not that page. Edit the content type itself, article and/or page, to find the data field for enabling xmlsitemap for the content type.

bitshift’s picture

Thanks a bunch for the assistance.
Ok, I managed to find the xml sitemap settings for the two default content types I currently have, and sure enough the settings for "inclusion" were set to "excluded". However, after setting those, I still get
"here are currently no XML sitemap contexts available." when clicking on the edit link for the sitemap.

Maybe try clearing my cache again?

Also going to try the above steps later this afternoon, after uninstalling the dev version and reinstalling the beta version.

Anonymous’s picture

Or just waiting on the cron to do its job.

bitshift’s picture

Nope, I ran cron also

AlexisWilke’s picture

bitshift,

The message you are talking about is the point of this issue. The message is very misleading. The fact is the default XML sitemap does not require a context (it is the default context.)

We, the people, are trying to get the authors to change that message, hence this post.

Thank you.
Alexis Wilke

bitshift’s picture

I was having more issues than just the message. What is the meaning of the "edit" link listed with the generated sitemap? What are you supposed to be able to do? That is when I get the message about no context. Yesterday I re-installed the beta version and continue to get that message when I click on "edit". Strange though, today I have many more links in the sitemap after running cron a few times.

Also, I see the node paths instead of the url alias is whats getting into the sitemap. Maybe that is a separate issue and Im off to search on that one.

AlexisWilke’s picture

That message is hard coded in the module. You cannot get rid of it without editing the PHP code and changing it (if you feel like doing so.) You can safely ignore it. Anything should raise an issue if you don't get the XML sitemap that you would otherwise expect. Yet it sounds like you are good on that already.

Note that I'm not one of the authors of this module.

Thank you.
Alexis Wilke

bitshift’s picture

Thanks for all the help, but I think I found a solution. The real problem wasnt with the sitemap all along, it was with my clean urls settings. Once that was resolved, the xml sitemap started behaving correctly. See this post for more info.

Anonymous’s picture

From the project page.

Please read the included README.txt, the handbook documentation, and the current list of known issues for more information before using the module.

At least a couple of the links state "Please note that using clean URLs is highly recommended."

Coyote’s picture

Actually, this doesn't look too hard to implement. Now that I've said that, I'll probably blow up my dev site.

samdeskin’s picture

After half an hour of playing with this, I finally figured it out.

Visit this page:
admin/config/search/xmlsitemap/settings

Go to the section that has Frontpage, Menu Link, Content, and Taxonomy Terms.

Include everything that is excluded that you want.

Then visit:
admin/config/search/xmlsitemap

Delete the existing sitemap.

Then visit:
admin/config/search/xmlsitemap/rebuild

Rebuild a new sitemap.

Go back here:
admin/config/search/xmlsitemap

Add a new sitemap. Then update the cached files.

Visit the sitemap:
sitemap.xml

Do a hard refresh:
Control + F5

That was much harder than it needed to be.

Can I suggest an update to this module to include all public facing content pages? That would make this much easier for a new install.

ikeigenwijs’s picture

This worked for me for generating the sitemap. It is pressent at XMLsitemap/(bunch of chars)/1.xml
But still the message:Page not found

eigentor’s picture

@samdeskin: Your method sounds promising. There is only one problem

http://screencast.com/t/mZrD2oHfth
Access denied for the /rebuild page, even though I am logged in as user 1.

I am using 7.2.rc1 and had a hell of a time getting old 6.x tables out of the database (manually deleted all stuff in the end) and re-enabling the 7.x version.

I guess that is the source of the problems, but I still do not know how to fix them.

luthien’s picture

Still getting the same errors, even after rebuilding sitemap. Also visiting the sitemap gives this error:

ML Parsing Error: XML or text declaration not at start of entity
Location: http://domainname.com/sitemap.xsl
Line Number 1, Column 2: <?xml version="1.0" encoding="UTF-8"?>
-^
themic8’s picture

Issue summary: View changes

I have the same issue as comment 28.

themic8’s picture

I searched my custom modules and custom theme extensively. I even reviewed contrib modules with no luck.

I update my core files and the problem went away. From reviewing other XML related issues like this it seems like a space can get in there from moving the code around.

If you are having this issue I would either update your core or redownload core.

ElegantSolutions’s picture

The steps from samdeskin #25 were exactly what I needed.

The most helpful step was:

Visit the sitemap:
sitemap.xml

Do a hard refresh:
Control + F5

The refresh was what was required to see the updated data.

jaesperanza’s picture

In my case, the persistent error appears both on clicking edit an existing sitemap or add a new sitemap. There was a cache implemented by hosting provider (SiteGround, Supercacher), disabling and flushing this cache made the edit and add links work again. Then turned the cache on again.

labman’s picture

I have over 3000 pages, all of which are excluded. Is there a way of enabling them all at once?

labman’s picture

headbank’s picture

I have to agree on the language being misleading or at least needing more clarity.

My situation was having migrated a site to HTTPS, the sitemap still contained http: URLs even after rebuilding files (this was eventually solved by changing the Default Base URL property in Settings, though that step had not been necessary in other sites - anyway, besides the point here).

My first approach was to click "Edit" on the default sitemap, but this yielded only that message and a Save/Cancel UI. I guessed (correctly) that this form must only have contents if additional modules were enabled, and tried the next tactic of deleting and re-creating the default sitemap (loftily ignoring the recommendation against doing this, I know - the next tactic would have been reinstalling the module anyway so I threw caution to the wind!).

After deleting, I clicked "Add new sitemap" only to be greeted by that same inscrutable message and Save/Cancel. IMHO it's far from clear that the correct action at this point is to click Save in order to create the default sitemap, and there was a moment of panic at this.

I'd suggest at the very minimum that, when there is no default sitemap, either (a) an additional line should be added pointing out the need to click Save to create the new one, or (b) in that scenario the button label should be Create instead of Save.

delta’s picture

well 8 years later here I come to this issue to understand what this message means :0 at least I didn't have to dig in the source code.
My initial attempt was to have a separate sitemap for nodes and for users. But apparently I need a context :)

kdleon’s picture

I'm trying to add another XML sitemap by clicking on 'Add new XML sitemap' and clicked on the Save button , however, it returns with this message "A sitemap with the same context already exists." Is it not possible to add multiple XML sitemaps for say different menus/ content type/subsites?

kdleon’s picture

I'm trying to add another XML sitemap by clicking on 'Add new XML sitemap' and clicked on the Save button , however, it returns with this message "A sitemap with the same context already exists." Is it not possible to add multiple XML sitemaps for say different menus/ content type/subsites?