Page 1 of 1

Sitemap contains items set to a future publish time

Posted: Sat Apr 18, 2009 5:11 pm
by Cenic
Hi,

I have created an item that has been set to be published at a point in time in the future. Currently the item does not show up on my blog. So far, so good.

Then I noticed that the link to the article was already present in the sitemap generated by the sitemap plugin (version: 0.46). Accessing the published link gave a 404 error as expected.

It seems that the sitemap plugin does not honor items published in the future when the sitemap is generated. In my opinion those articles should not show up in the sitemap until they are really available. Obviously it is unfeasible to regenerate the sitemap when the article is due but I would rather have items missing in the sitemap than have items that do not yet exist.

The fix would be to include an additional clause in the queries used by the plugin to filter entries that have a timestamp in the future. In PostgreSQL one could use something like the following:

Code: Select all

...
AND entries.timestamp < (SELECT EXTRACT(EPOCH FROM current_timestamp))
...
It looks like MySQL does not support the exact same syntax. Maybe it would be the best way to generate the current timestamp in PHP and then use that as literal in the queries.

Regards,
Stefan

Re: Sitemap contains items set to a future publish time

Posted: Sun Apr 19, 2009 6:15 pm
by garvinhicking
Hi!

you are right, many thanks for noticing. I've just committed a fix for this to be contained in the next plugin version 0.47, available through spartacus within the next 24-48 hours.

Regards,
Garvin

Re: Sitemap contains items set to a future publish time

Posted: Mon Apr 20, 2009 4:24 am
by Don Chambers
Nice observation Stefan!! Excellent suggestion! :wink: