Bugzilla – Attachment 167431 Details for
Bug 36977
Google does not read sitemaps with the name sitemapNNNN.xml
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 36977: Google does not read sitemaps with the name sitemapNNNN.xml
Bug-36977-Google-does-not-read-sitemaps-with-the-n.patch (text/plain), 2.53 KB, created by
Michael Skarupianski
on 2024-06-05 09:05:27 UTC
(
hide
)
Description:
Bug 36977: Google does not read sitemaps with the name sitemapNNNN.xml
Filename:
MIME Type:
Creator:
Michael Skarupianski
Created:
2024-06-05 09:05:27 UTC
Size:
2.53 KB
patch
obsolete
>From ece907e097208d0f9f4f8b2c80d6d453a8d1048d Mon Sep 17 00:00:00 2001 >From: Janusz Kaczmarek <januszop@gmail.com> >Date: Tue, 28 May 2024 20:16:09 +0000 >Subject: [PATCH] Bug 36977: Google does not read sitemaps with the name > sitemapNNNN.xml > >We have experienced problems with Google indexing: it seems (controlled >in Google search console) that Google does not "like" sitemaps >with a name like sitemapNNNN.xml (does not read them). Changing the name >to sitemap_NNNN.xml miraculously resolves the issue: individual pieces of >sitemap are read as they are declared in sitemapindex.xml. > >Test plan: >========== >1. Have your site configured to work with Google search console > (cf. https://support.google.com/webmasters/answer/9008080). >2. Generate sitemap with: > misc/cronjobs/sitemap.pl --dir /var/lib/koha/<instance>/sitemap > (create the directory if necessary) >3. Check with you browser that the sitemap is generated: > http://<OPAC-url>/sitemapindex.xml > Check that the individual pieces are readeable: > http://<OPAC-url>/sitemap0001.xml >4. Go to the Google seach console > Sitemaps > Add a new sitemap > Enter sitemapindex.xml >5. Most probably Google won't read your sitemap chunks with the > warning: "Couldn't fetch". >6. Apply the patch. Repeat p. 2, 3, 4, with the difference of the > chunk name: > http://<OPAC-url>/sitemap_0001.xml >7. You should see Google reading your entire sitemap with the info: > "Success". > >Signed-off-by: Michael Skarupianski <michael.skarupianski@gmail.com> >--- > Koha/Sitemapper/Writer.pm | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > >diff --git a/Koha/Sitemapper/Writer.pm b/Koha/Sitemapper/Writer.pm >index 309c49db31..14d4f60e31 100644 >--- a/Koha/Sitemapper/Writer.pm >+++ b/Koha/Sitemapper/Writer.pm >@@ -72,7 +72,7 @@ sub write { > if ( $self->current == $MAX ) { > $self->_writer_end(); > $self->count( $self->count + 1 ); >- my $w = $self->_writer_create( sprintf("sitemap%04d.xml", $self->count) ); >+ my $w = $self->_writer_create( sprintf("sitemap_%04d.xml", $self->count) ); > $w->startTag( > 'urlset', > 'xmlns' => 'http://www.sitemaps.org/schemas/sitemap/0.9', >@@ -110,7 +110,7 @@ sub end { > for my $i ( 1..$self->count ) { > $w->startTag('sitemap'); > $w->startTag('loc'); >- my $name = sprintf("sitemap%04d.xml", $i); >+ my $name = sprintf("sitemap_%04d.xml", $i); > $w->characters($self->sitemapper->url . "/$name"); > $w->endTag(); > $w->startTag('lastmod'); >-- >2.45.2
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 36977
:
167230
|
167345
|
167431
|
169815
|
173612
|
173613