开发者

Sitemap for dynamic PHP website ... the "lastmod" field is needed?

I've a really small website, so I usually update the sitemap by hand! In each "url" element there are the fields: loc, lastmod, changefreq and priority.

The "lastmod" field is setup to the date in witch I update the content of the related PHP page or the content that is loaded dynamically in the related PHP page!

I've tried to use http://www.xml-sitemaps.com/ to verify if all it was right, and I've noticed that in the generated sitemap there isn't the "lastmod" field!

In the Google wiki, about how to write a sitemap, there's written that is a good practice to setup the "lastmod" fie开发者_高级运维ld even for dynamic pages; so, my question is ...

Is the "lastmod" field needed or not?

Thanks in advace!


$lastmod = date('Y-m-dTH:i:s+00:00');

for more info, http://www.w3.org/TR/NOTE-datetime


You can use php date function to create last mod

How Last mode value is created

Sitemap for dynamic PHP website ... the "lastmod" field is needed?

<sitemap>
    <loc><?php echo url('/') ?>/sitemap/uk/lse/list</loc>
    <lastmod><?php echo date('c', time()); ?></lastmod>
</sitemap>


The standard says that it's optionnal : http://www.sitemaps.org/protocol.php#locdef :

<lastmod> optional

The date of last modification of the file. This date should be in W3C Datetime format. This format allows you to omit the time portion, if desired, and use YYYY-MM-DD.

Still, it might be usefull to let search engines / spiders know when your content was updated for the last time.


The How do I compute lastmod date? entry of the FAQ also gives an interesting reason, that explains why you should include the lastmod date if you can (quoting) :

Using even an approximate date or timestamp can help crawlers avoid crawling URLs that have not changed. This will reduce the bandwidth and CPU requirements for your web servers.


It's not mandatory but it's good to have it in order to let Google (and other engines) know when content updates happen on your site.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜