Tips for creating and fixing time-date format issue on google sitemap.xml

Salam Alikum and Peace  be upon you…
          Sitemap.xml is that simple XML data file that has the mostly the entire site links you liked search engines like google to crawler and keeps it so it would appear on searching and indexing your site.

While I was creating and developing my own dynamic blogging system ‘she7ata’s-blogs‘, I liked really to create the sitemap.xml dynamically, and that’s how I faced some issues like the time/date format and other issues.
I thought it was really an easy task, but I’ve spend couple of hours fixing things and returning back to sitemap protocol to know what is the problem

Here is a simple and quick tips for you to quickly generating a sitemap.xml file.
First, here is a simple xml file sample, maybe you can copy and past for quick start.



http://she7ata.com/blogs/categories/2/Islamic.html
2009-10-17T14:57:49+02:00
weekly 0.8

First, …

SHOULD START FROM LINE 0

first of all, I’ve encountered that problem, and I did not know what’s wrong, but after along time of testing, I discovered that if you left one line before the xml definition or header, your browser will never recognize or display your sitemap.xml file formatted as it should be, the same for RSS and ATOM xml feeds!.

Remember, that every URL has 4 basic elements, Loc or Location, last-modified date, change frequency and priority .
Priorities is very and till now I did not see it has a effect on anything, but you should have a value from 0 to 1.
Location is the location of the document or the file you’re indexing.
And finally the date-format should be on specific scheme like
yyyy-mm-ddThh:mm:ss+GTM
years-month-day(T)hour+GTM
example
2009-10-17T14:57:49+02:00

Please note that you will need to do some checking before generating date, because google will not accept a date like 2009-10-5T…. it should be 2009-10-05T…. that means you will check the length of the string representing the day and month and add one more Zero on the left hand side incase the length is one (one digit)

Please notice the google sitemap.xml invalid date error screenshot below.

http://www.she7ata.com is not equal to http://she7ata.com for google !

DO NOT POST LINKS OUTSIDE YOUR DOMAIN NAME

Google would stop processing your posted sitemap.xml file if they notice that you’re using a external link, even if you tried to post a link from within the same domain but with or without the www, google will give you alert, you should use EXACTLY the same domain you have used on your ‘google webmaster tools‘ account.

Sitemap resources.

  • For those people who liked to unde