diff --git a/docs/changelog/7.x.x.txt b/docs/changelog/7.x.x.txt index 6960696cd..9d5621b85 100644 --- a/docs/changelog/7.x.x.txt +++ b/docs/changelog/7.x.x.txt @@ -5,6 +5,7 @@ - fixed #11372: All Search Forms should use GET - fixed #11373: Problem creating FilePump bundles - fixed #11374: USPS shipping drivers take 3 minutes to timeout + - fixed #11044: Optionally include hidden pages in sitemap.xml 7.8.10 - fixed #11332: Pagination in webgui.org forum urls diff --git a/docs/gotcha.txt b/docs/gotcha.txt index bdfb6d447..db023dad4 100644 --- a/docs/gotcha.txt +++ b/docs/gotcha.txt @@ -11,6 +11,11 @@ save you many hours of grief. -------------------------------------------------------------------- * WebGUI now requires DateTime::Format::HTTP, to handle parsing HTTP dates. + * The Google sitemap generator in WebGUI was including hidden pages in the list of + pages. This is now configurable, with the default being to NOT show hidden pages. + If you wish hidden pages to be shown, then in the config file set showHiddenPages + to 1. + 7.8.6 -------------------------------------------------------------------- * WebGUI now requires LWP 5.833 or higher, to fix a bug in that module. diff --git a/docs/upgrades/upgrade_7.8.10-7.8.11.pl b/docs/upgrades/upgrade_7.8.10-7.8.11.pl index d45cbc01d..a20214634 100644 --- a/docs/upgrades/upgrade_7.8.10-7.8.11.pl +++ b/docs/upgrades/upgrade_7.8.10-7.8.11.pl @@ -31,6 +31,7 @@ my $quiet; # this line required my $session = start(); # this line required # upgrade functions go here +addSiteIndexToConfig($session); finish($session); # this line required @@ -44,6 +45,16 @@ finish($session); # this line required # print "DONE!\n" unless $quiet; #} +#---------------------------------------------------------------------------- +# Describe what our function does +sub addSiteIndexToConfig { + my $session = shift; + print "\tAdd Site Config indexing section to config file... " unless $quiet; + $session->config->set('siteIndex', { showHiddenPages => 0 }); + # and here's our code + print "DONE!\n" unless $quiet; +} + # -------------- DO NOT EDIT BELOW THIS LINE -------------------------------- diff --git a/etc/WebGUI.conf.original b/etc/WebGUI.conf.original index 46fbddd80..fac8937c1 100644 --- a/etc/WebGUI.conf.original +++ b/etc/WebGUI.conf.original @@ -1071,4 +1071,10 @@ "Opera Mini" ], +#A list of UserAgents of recognized mobile platforms. If useMobileStyle is set in the +#Admin settings, then the mobile style will be used for these browsers. + "siteIndex" : { + "showHiddenPages" : 0 + } + } diff --git a/lib/WebGUI/Content/SiteIndex.pm b/lib/WebGUI/Content/SiteIndex.pm index de77fd145..65c36a53c 100644 --- a/lib/WebGUI/Content/SiteIndex.pm +++ b/lib/WebGUI/Content/SiteIndex.pm @@ -16,6 +16,7 @@ package WebGUI::Content::SiteIndex; use strict; use WebGUI::Asset; +use WebGUI::Exception; use XML::Simple; =head1 NAME @@ -53,17 +54,28 @@ sub handler { unless ($p =~ m/sitemap\.xml$/i) { return undef; } + + my $whereClause = "assetData.groupIdView = 7"; + if (! $session->config->get("siteIndex")->{showHiddenPages}) { + $whereClause .= ' AND assetData.isHidden=0'; + } - my $pages = WebGUI::Asset->getRoot($session)->getLineage(["self","descendants"],{ + my $pages = WebGUI::Asset->getRoot($session)->getLineageIterator(["self","descendants"],{ returnObjects => 1, includeOnlyClasses => ["WebGUI::Asset::Wobject::Layout"], - whereClause => "assetData.groupIdView = 7", + whereClause => $whereClause, limit => 20000 }); my $url = []; - foreach my $page (@{$pages}) { + ASSET: while (1) { + my $page = eval { $pages->() }; + if (my $e = Exception::Class->caught()) { + $session->log->error($@); + next ASSET; + } + last ASSET unless $page; push(@{$url},{ loc => $session->url->getSiteURL().formatXML($page->getUrl), lastmod => $session->datetime->epochToSet($page->get("revisionDate")), @@ -112,4 +124,3 @@ sub formatXML { 1; -