Support Forum

Wrong Sitemap XML-Format (?) of the Google-XML-Sitemap plugin

KA Kalle1887
Kalle1887
Member

Hi all,

I use the simple:press Google-XML-Sitemap plugin (in combination with Yoast WordPress SEO plugin).
At the Google Webmaster tools I get an error because of the date-format.
It`s not e.g. “2015-02-23 12:29” but “1424696380”.

You can see the problem here:
http://vogel-beobachtung.de/sitemap_index.xml

Has anybody an idea how to change this?

 

Thank you very much, Kalle

10 Answers

New Answer

YS Yellow Swordfish
Yellow Swordfish
Member

I think you need to update it to the latest version. Should be in your WordPress updates list.

KA Kalle1887
Kalle1887
Member

Hi Yellow Swordfish,

thank you very much, but I use simple:press Version 5.5.4 and Google XML-Sitemap 2.3.2.
I think these are the newest versions?

 

Best regards, Kalle

YS Yellow Swordfish
Yellow Swordfish
Member

Curious… Are you using the most recent version of Yoast as well?

A user reported a problem with dates prior to our 5.5.4 release which was fixed and released in the GSP 2.3.2 release and verified as corrected at that time. 

KA Kalle1887
Kalle1887
Member

Yes, also Yoast is the newest version.

A weird thing is:

If I have a look at: http://vogel-beobachtung.de/sitemap_index.xml

…the time format is in the “wrong” format, but if I visite:

http://vogel-beobachtung.de/forum-sitemap.xml

..the format is well. Might that be a bug?

 

Best regards, Kalle

YS Yellow Swordfish
Yellow Swordfish
Member

I am sorry to say that our Google Sitemap, SEO and Yoast team member is on vacation at the moment so I am ill-equipped to know. I am going to find the thread that raised the date issue in the first place to see if there is any information that might help. Will post back in a little while.

YS Yellow Swordfish
Yellow Swordfish
Member

here is the thread: https://simple-press.com/support-forum/sp5-general-topics/yoast-sitemap-invalid-date-format/

I don’t know if that helps but does it sound like a similar issue? The latest code you are using does have this change in it.

KA Kalle1887
Kalle1887
Member

HI Yellow Swordfish,

 

thank you very much. That was a good help.

 

I changed:

function sp_google_sitemap_do_generate_yoast_main() {
    $map = ”;

    $base = $GLOBALS[‘wp_rewrite’]->using_index_permalinks() ? ‘index.php/’ : ”;
    $date = spdb_table(SFPOSTS, ”, ‘UNIX_TIMESTAMP(post_date)’, ‘post_date DESC’, ‘1’);
    $map.= ‘<sitemap>’.”
“;
    $map.= ‘<loc>’.home_url($base.’forum-sitemap.xml’).'</loc>’.”
“;
    $map.= ‘<lastmod>’.date($date).’ </lastmod>’.”
“;
    $map.= ‘</sitemap>’ . “
“;

    return $map;
}

 

Into:

 

function sp_google_sitemap_do_generate_yoast_main() {
    $map = ”;

    $base = $GLOBALS[‘wp_rewrite’]->using_index_permalinks() ? ‘index.php/’ : ”;
    $date = spdb_table(SFPOSTS, ”, ‘UNIX_TIMESTAMP(post_date)’, ‘post_date DESC’, ‘1’);
    $map.= ‘<sitemap>’.”
“;
    $map.= ‘<loc>’.home_url($base.’forum-sitemap.xml’).'</loc>’.”
“;
    $map.= ‘<lastmod>’.htmlspecialchars(date(‘c’, $date)).'</lastmod>’.”
“;
    $map.= ‘</sitemap>’ . “
“;

    return $map;
}

 

…now it works :-)

YS Yellow Swordfish
Yellow Swordfish
Member

Wow! That IS good news. I will pass this thread on to @mr-papa when he returns…

Thanks for the update and glad it was easily sorted.

MP Mr Papa
Mr Papa
Member

odd.. at first blush (and just back from 2 week cruise!), not sure why the change would be needed…

but will investigate it…

MP Mr Papa
Mr Papa
Member

something amiss here… will get it fixed up… ticket open…