Switch to get_post_modified_time for UTC #94

Merged
merged 1 commit into from Dec 9, 2016

Projects

None yet

3 participants

@mjangda
Member
mjangda commented Dec 9, 2016

Since we signify the datestamp as UTC via the z

props kimcheung

Fixes #88

@mjangda mjangda Switch to get_post_modified_time for UTC
Since we signify the datestamp as UTC via the z

props kimcheung
6cd717a
@mjangda mjangda merged commit 79b04bc into master Dec 9, 2016

0 of 2 checks passed

continuous-integration/travis-ci/pr The Travis CI build is in progress
Details
continuous-integration/travis-ci/push The Travis CI build is in progress
Details
@mjangda mjangda deleted the fix/lastmod-time branch Dec 9, 2016
@@ -441,7 +441,7 @@ public static function generate_sitemap_for_date( $sitemap_date ) {
$url = $xml->addChild( 'url' );
$url->addChild( 'loc', get_permalink() );
- $url->addChild( 'lastmod', get_the_modified_date( 'Y-m-d' ) . 'T' . get_the_modified_date( 'H:i:s' ) . 'Z' );
+ $url->addChild( 'lastmod', get_post_modified_time( 'Y-m-dTH:i:sZ', true ) );
@nschoenholtz
nschoenholtz Jan 5, 2017

@romancandlethoughts found a bug, and I think we've tracked it to this change -- would it be possible to use c format here? Or if not, the T needs to be escaped I think, and possibly the Z swapped for P?

I'd be happy to make a PR if you'd like, but figured it'd make sense to start a discussion first. Thanks!

@mjangda
mjangda Jan 5, 2017 Member

I think c is probably good enough. A PR would be great.

@romancandlethoughts
romancandlethoughts Jan 6, 2017

I was just about to update this, thanks @mjangda, you're the best!

@mjangda mjangda added a commit that referenced this pull request Jan 6, 2017
@mjangda mjangda Use `c` as the date format for lastmod
The format we introduced in #94 was a bit broken.

props @nschoenholtz and @romancandlethoughts
9111879
@mjangda mjangda added a commit that referenced this pull request Jan 6, 2017
@mjangda mjangda Use `c` as the date format for lastmod (#101)
The format we introduced in #94 was a bit broken.

props @nschoenholtz and @romancandlethoughts
94b724c
@mjangda
Member
mjangda commented Jan 14, 2017

Here's a command that can be used to fix broken sitemaps created because of this issue: https://gist.github.com/mjangda/466bded7ad9de17169b1bccfc4ffd454

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment