Skip Menu |

This queue is for tickets about the Search-Sitemap CPAN distribution.

Report information
The Basics
Id: 44660
Status: resolved
Priority: 0/
Queue: Search-Sitemap

People
Owner: Nobody in particular
Requestors: cjm [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 2.06
Fixed in: (no value)



Subject: [PATCH] Don't include empty tags
I just got around to upgrading from WWW::Google::SiteMap (I had missed the rename). When I compared my old sitemap to the new one, I found that Search::Sitemap was including "<priority></priority>" and "<changefreq></changefreq>" in <url>'s where I had not set a value. According to sitemaps.org, those tags are optional. I'm not sure how empty tags would be treated by search engines, but I don't think it's a good idea to include them. I've attached the small patch I came up with to fix the problem. It omits any attribute whose value hasn't been set. I also fixed what appears to be a typo. The clearer for changefreq was 'clear_lastmod'. PS: http://www.jasonkohles.com/software/search-sitemap is giving me a 404 error, and http://www.jasonkohles.com/software/ gives me a 403. PPS: You might want to take WWW-Google-SiteMap-1.09, add a note to the documentation that it's been replaced by Search-Sitemap, and release it as WWW-Google-SiteMap-1.10. I bet I'm not the only person who didn't notice you renamed it.
Subject: SSU_emptytag.patch
--- Search/Sitemap/URL.pm 2009-03-28 17:15:08.000000000 -0500 +++ Search/Sitemap/URL.pm 2009-03-28 18:15:39.313792565 -0500 @@ -37,7 +37,7 @@ isa => SitemapChangeFreq, coerce => 1, predicate => 'has_changefreq', - clearer => 'clear_lastmod', + clearer => 'clear_changefreq', ); has 'lastmod' => ( is => 'rw', @@ -84,6 +84,8 @@ my @elements = (); for my $f ( @fields ) { + my $exists = $self->can("has_$f"); + next if $exists and not $self->$exists; # Omit missing fields my $method = '_'.$f.'_as_elt'; my $val; if ( $self->can( $method ) ) {
On Sun Mar 29 20:58:26 2009, CJM wrote: Show quoted text
> I just got around to upgrading from WWW::Google::SiteMap (I had missed > the rename). When I compared my old sitemap to the new one, I found > that Search::Sitemap was including "<priority></priority>" and > "<changefreq></changefreq>" in <url>'s where I had not set a value. > According to sitemaps.org, those tags are optional. I'm not sure how > empty tags would be treated by search engines, but I don't think it's a > good idea to include them. > > I've attached the small patch I came up with to fix the problem. It > omits any attribute whose value hasn't been set. > > I also fixed what appears to be a typo. The clearer for changefreq was > 'clear_lastmod'. >
Thanks for the patch, I'm shipping 2.07 now which fixes both these problems. Show quoted text
> PS: http://www.jasonkohles.com/software/search-sitemap is giving me a > 404 error, and http://www.jasonkohles.com/software/ gives me a 403. >
Yeah, I haven't actually finished the pages yet. Show quoted text
> PPS: You might want to take WWW-Google-SiteMap-1.09, add a note to the > documentation that it's been replaced by Search-Sitemap, and release it > as WWW-Google-SiteMap-1.10. I bet I'm not the only person who didn't > notice you renamed it.
I've been planning to do this, just haven't had the time yet... -- www.jasonkohles.com