Closed jeffwhitfield closed 8 years ago
Alright, so I did a little more digging. I fixed the issue where the sitemap returns no results by making sure the domain name listed in the subsite setting had a full www address. However, now that its returning results...the results are only for the primary site, not the subsite. I narrowed down the problem to the sitemap
method in GoogleSitemapController.php
.
Basically, any call to the getItems
method of the GoogleSitemap
class keeps returning the main site and doesn't filter anything based on the SubsiteID value. So, perhaps this could be updated to check for the presence of a SubsiteID and then set a filter?
I tried to add a filter to the call to the Versioned
class on line 223 in GoogleSitemap.php
:
$instances = Versioned::get_by_stage('SiteTree', 'Live', array('SubsiteID' => 1));
That should force it to only return results for the first subsite but it only results in an empty result. Odd. If I change it to 0 then it returns results for the main site. I'm wondering if there's a permission issue in the Subsite module code that is blocking the results. Freakin' weird! :P
Ok, so if I turn off the www version of the domain...it works. Turn the www domain back on...it doesn't. So, apparently, there's something in there that doesn't like any www domain...only non-www domains. So confused!
Ok, problem solved! Finally found the culprit! Apparently, with any WWW domain, if you don't turn on strict subdomain matching it'll filter the list as a non-WWW domain and thus give bad results. So...gonna flip this on on over to the Subsite module folks for review. Temp solution is to simply turn on strict subdomain matching by adding this to your _config.php
file:
Subsite::$strict_subdomain_matching = true;
Hey folks! Client of mine just noticed that the sitemap for one of his subsites isn't returning any pages. Looks like the something isn't working right with the Subsites add-on (https://github.com/silverstripe/silverstripe-subsites). The main site returns results in the sitemap (although there appears to be some odd duplicates here and there). But any subsites return empty results. Odd.
Currently running on SilverStripe v3.4 with the Subsite module set for '1.*@dev' and Google Sitemaps set for the latest dev-master version. Tried different versions of each module but nothing worked.
Any ideas on what the problem might be?