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.
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"?>
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