If you are new to XML sitemaps or need more information about Google XML sitemap generation, you should read this tutorial before going any further. This tutorial helps you develop your own PHP-based Google XML Sitemap generator. This is a customized approach, which means that you can feed the application your canonical URLs (sorted by highest to lowest in terms of importance and priority) and it will output the XML syntax for your sitemap.xml. The XML syntax can then be copy to a blank text file (for example, in notepad) and uploaded to your website. This offers a lot of advantages compared to other XML sitemap solutions available online, for two reasons. First, Google advises webmasters to submit XML sitemaps that contain ONLY canonical URLs. If you use third party sitemap generator software that you can find online, you will need to do a lot of work filtering the sitemap's XML code for canonical URLs. Second, other sitemap generators impose a limit. For example, they may only process 500 URLs. This can strongly affect you if your website has more than 500 canonical URLs. Web Application Design of Customized Sitemap Generator Any PHP web application starts with a design. The canonical URLs are put into a web form. Since there is more than one line of input (the typical number of canonical URLs for a large website can exceed 100), you are going to use a text area instead of a single text box, so that all URLs can be accommodated. Screen shot: The actual PHP script will then be used to perform four tasks: 1. Parse the URL from the web form. 2. Compute the priorities of the URL, which is used for the sitemap. 3. Generate the XML syntax. 4. Output the generated syntax with computed priorities back to the user's web browser. The XML syntax should conform to the Google XML sitemap standard. An example of a conforming XML syntax is: <?xml version="1.0" encoding="UTF-8"?> <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url> <loc>http://www.php-developer.org/ </loc> <priority>1</priority> </url>
<url> <loc>http://www.php-developer.org/how-long-does-it-take-for-dns-to-propagate-in-godaddy-hosting/ </loc> <priority>0.97</priority> </url>
<url> <loc>http://www.php-developer.org/solution-for-blogger-you-are-about-to-redirected-message-problem/ </loc> <priority>0.95</priority> </url> </urlset> To easily troubleshoot XML syntax, it is best to use standard colors for the XML syntax. You can easily distinguish the URLs from the XML tags:
Of course, since you are accepting user inputs, you might as well filter bots from using the web form with a security code or a captcha system.
blog comments powered by Disqus |
|
|
|
|
|
|
|