Ticket #109 (closed enhancement: wontfix)

Opened 6 weeks ago

Last modified 6 weeks ago

Correct sitemap date

Reported by: lifeisfoo@… Owned by:
Priority: minor Component: sitemaps
Keywords: sitemaps plugin Cc:

Description

The stample version of sitemap plugin (0.6), display in sitemap.xml date in atom-time format. The correct time format is yyyy-mm-dd (from http://sitemaps.org/protocol.php ). I added a function to utils.php

public static function sitemaptime($t) {

if ( ! is_numeric( $t ) ) {

$t = strtotime( $t );

} return date( "Y-m-d", $t );

}

and changed line 88 of sitemaps.plugin.php:

from

$url_lastmod= $url->addChild( 'lastmod', Utils::atomtime( $entry->updated ) );

to

$url_lastmod= $url->addChild( 'lastmod', Utils::sitemaptime( $entry->updated ) );

Attachments

Change History

Changed 6 weeks ago by lifeisfoo@…

sorry, stable.

Changed 6 weeks ago by rickc

The link to sitemaps.org which you gave says the date format should be in W3C datetime format, but you can leave off the time part of the W3C datetime. You are not required to do so, however. Sitemaps.org links to http://www.w3.org/TR/NOTE-datetime. This document describes ISO 8601, which can have the following forms:

Year:

YYYY (eg 1997)

Year and month:

YYYY-MM (eg 1997-07)

Complete date:

YYYY-MM-DD (eg 1997-07-16)

Complete date plus hours and minutes:

YYYY-MM-DDThh:mmTZD (eg 1997-07-16T19:20+01:00)[[BR]]

Complete date plus hours, minutes and seconds:

YYYY-MM-DDThh:mm:ssTZD (eg 1997-07-16T19:20:30+01:00)[[BR]]

Complete date plus hours, minutes, seconds and a decimal fraction of a second

YYYY-MM-DDThh:mm:ss.sTZD (eg 1997-07-16T19:20:30.45+01:00)[[BR]]

I can understand wanting to have the option of including the time or not, though.

Changed 6 weeks ago by chrismeller

FWIW, that next-to-late option is the ATOM format. :)

Why would you ever want to only publish the date?

Changed 6 weeks ago by lifeisfoo@…

You are right. sorry

Changed 6 weeks ago by rickc

  • status changed from new to closed
  • resolution set to wontfix

The sitemaps plugin uses a valid format to display the post updated date, so I'm closing it as wontfix. Feel free to create a ticket based on having the option to use or not use the time in the updated date, though.

Add/Change #109 (Correct sitemap date)

Author



Change Properties
<Author field>
Action
as closed
Next status will be 'reopened'
 
Note: See TracTickets for help on using tickets.