Sitemaps are an easy way for webmasters to inform search engines about pages on their sites that are available for crawling. In its simplest form, a Sitemap is an XML file that lists URLs for a site along with additional metadata about each URL (when it was last updated, how often it usually changes, and how important it is, relative to other URLs in the site) so that search engines can more intelligently crawl the site.
In today’s tutorial, I am going to show you how to build dynamic sitemap in PHP (fetching content from the database) and style it using an xsl stylesheet. Before I dig into the code, have a look at a sample sitemap format.
<?xml version="1.0" encoding="utf-8"?>
The above code shows a sitemap format which is having only one url. Sitemap is nothing but an xml(eXtensible Markup Language) file with a defined format.
Here is the code which will generate the sitemap by fetching the posts from the database.
So, now you know how you can generate dynamic sitemaps for your website which are nicely styled as well.
That’s all for today. Do comeback tomorrow for more awesomeness.