I have changed the lastmod format to ('d-m-Y h:i:s') but is still not working? only half of the sitemap feeds have changed?
Please can someone help?
Please can someone help?
In Extensions
Share this post:
Accepted Answer
The code is not showing right here because is not wrapped with code tag so try to implement this one: https://github.com/arastta/arastta/pull/406/files
Responses (33)
-
Accepted Answer
-
Accepted Answer
-
Accepted Answer
It's not easy to follow your writings, but you have changed it in /catalog/view/theme/*/template/feed/google_sitemap.tpl - right?
Clock time isn't really needed, Google will accept Y-m-d too, last time I tested I used:
<?php if (isset($result['date'])) { ?>
<lastmod><?php echo date('Y-m-d', strtotime($result['date'])); ?></lastmod>
<?php } else { ?>
<lastmod><?php echo date('Y-m-d'); ?></lastmod>
<?php } ?>
But I guess it could also work with something like (not tested):
<?php if (isset($result['date'])) { ?>
<lastmod><?php echo date('Y-m-d', strtotime($result['date'])) . 'T' . date('H:i:s', strtotime($result['date'])) . '+2.00'; ?></lastmod>
<?php } else { ?>
<lastmod><?php echo date('Y-m-d') . 'T' . date('H:i:s') .'+2.00'; ?></lastmod>
<?php } ?>
BUT, I guess that timezone addition (+2.00) is depending on servers timezone. I would skip it ...
EDIT! Those are the valid formats: https://www.w3.org/TR/NOTE-datetime - but only YYYY-MM-DD is required when using the optional lastmod tag: http://www.sitemaps.org/protocol.html -
Accepted Answer
-
Accepted Answer
-
Accepted Answer
-
Accepted Answer
-
Accepted Answer
OK Looking now but it is not what google is saying?
Errors
Invalid date
An invalid date was found. Please fix the date or formatting before resubmitting.
52
Parent tag: url
Tag: lastmod
Value: 2016-04-12 01:26:20
4
Apr 12, 2016
Parent tag: url
Tag: lastmod
Value: 2016-04-12 01:26:20
15
Apr 12, 2016
Parent tag: url
Tag: lastmod
Value: 2016-04-12 01:26:20 -
Accepted Answer
-
Accepted Answer
-
Accepted Answer
-
Accepted Answer
Bobby winters wrote:
Something is not right with that code?
Thanks
Do you try that code above?
As reference, you can check link below
function date php
Your Reply
Please login to post a reply
You will need to be logged in to be able to post a reply. Login using the form on the right or register an account if you are new here.
Register Here »