You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In some cases where DataObjects are registered, and that override the canView method (such as when posts are to be moderated before viewing, or could have some automatic expiration built in) it's possible for a sitemap file to be generated that's completely empty.
For example, I have the following dataobject Classified that expires after a set number of days.
in this case the older classifieds, while they still exist as dataobjects, return a value of false for canView (as they should), and thus do not appear in the individual sitemaps, but this means that the last two sitemaps are blank; Only Classifieds/1 has any entries, and google complains about /2 and /3 with errors.
A fix could either be:
The list of items is filtered by canIncludeInGoogleSitemap (least efficient, since it is o(n) speed).
Set some kind of extension in GoogleSitemap::get_sitemaps and GoogleSitemap::get_items to augment the DataList prior to page segmentation. Maybe something like singleton($class)->filterGoogleSitemapItems($list);
As a variation of the second option, there could perhaps some kind of query parameter on the DataList that's picked up by GoogleSitemapExtension.
The first option is the simplest, but least efficient, while the second allows items to be pre-filtered at the point of query, but requires additional code on the user's part.
As an aside, I apologise for the lack of attention to my other issue; I'll hopefully get more time in the coming months to review my outstanding PRs and issues. :)
The text was updated successfully, but these errors were encountered:
In some cases where DataObjects are registered, and that override the
canView
method (such as when posts are to be moderated before viewing, or could have some automatic expiration built in) it's possible for a sitemap file to be generated that's completely empty.For example, I have the following dataobject
Classified
that expires after a set number of days.My sitemap.xml file looks like the below;
in this case the older classifieds, while they still exist as dataobjects, return a value of false for canView (as they should), and thus do not appear in the individual sitemaps, but this means that the last two sitemaps are blank; Only
Classifieds/1
has any entries, and google complains about /2 and /3 with errors.A fix could either be:
GoogleSitemap::get_sitemaps
andGoogleSitemap::get_items
to augment the DataList prior to page segmentation. Maybe something likesingleton($class)->filterGoogleSitemapItems($list);
GoogleSitemapExtension
.The first option is the simplest, but least efficient, while the second allows items to be pre-filtered at the point of query, but requires additional code on the user's part.
As an aside, I apologise for the lack of attention to my other issue; I'll hopefully get more time in the coming months to review my outstanding PRs and issues. :)
The text was updated successfully, but these errors were encountered: