How to Create a Sitemap in ↓markdown↓ CMS
The ↓markdown↓ Content Management System (CMS) comes with a HTML website index and XML site map generator. Any pages added to a website built using markdown CMS are automatically seen in the full website index. This indexing includes functionality to generate the XML site map file (sitemap.xml).
Although site map is two words it is common to see it written without the space, i.e. sitemap because of the name of the data file, sitemap.xml. This XML site map file is used by web search providers, e.g. Google, Bing/Yahoo, DuckDuckGo. They recommend you create a sitemap.xml file so that the structure of a website is correctly understood. This improves the site's listing in search results. In other words making a site map data file is good for Search Engine Optimisation (SEO).
The default web page for a web address is called an index page. This is different from a full website index, which is used to display the full contents of a website, sometimes as an A to Z index listing. Entering a web address, e.g. example.com will cause the web server to look for an index.html file, this is an index page. But a full HTML website index would display all the contents available from example.com.
A sitemap.xml Generator and HTML Website Index for Free
The full HTML website index and sitemap.xml generator in ↓markdown↓ CMS comes for free. The indexing code automatically detects a new web page when it is created in, or added to, a ↓markdown↓ CMS based website. To generate the HTML website index and sitemap.xml file the browser needs to be pointed at the md-sitemap.php file. The easiest way is a link from an existing web page.
In a Markdown text file use a Markdown/CommonMark link format to point to md-sitemap.php in the md directory of a ↓markdown↓ CMS website:
[Full Website Index](http://www.example.com/md/md-sitemap.php "All Our Pages")
[Full Website Index] ... other text ... :http://www.example.com/md/md-sitemap.php "All Our Pages")
As an HTML anchor tag:
<a href="http://www.example.com/md/md-sitemap.php" title="All Our Pages">Full Website Index</a>
There is no a restriction on the number of web pages listed in the HTML website index or sitemap.xml by the sitemap builder code. Though ultimately the possible unlimited pages depends upon the web server resources. For the sitemap.xml a new file is generated for each 50000 entries (named sitemap-x.xml where x starts at 1).
How to Create a Sitemap for a Website
For a newly installed ↓markdown↓ CMS website the sitemap.xml file will not exist. To generate sitemap.xml visit the md/md-sitemap.php page. This causes the full HTML website index to be displayed in the browser, but also writes sitemap.xml to the root of the website. Once sitemap.xml has been generated it will not be generated again until it reaches a certain age. The default is one week old. To change the timescale for generating a new sitemap.xml edit the XML_SITEMAP_REFRESH setting in the *site-config.php file (default is -1 week, try -1 day, -1 month, etc.).
If the sitemap.xml needs to be updated before the automatic refresh simply log into the web server and delete it. Then visit the site index page (ms/md-sitemap.php) to recreate a fresh sitemap.xml.
For other articles on using ↓markdown↓ CMS see the post Build a Website from Scratch with ↓markdown↓ CMS.
Author:Daniel S. Fowler Published: Updated: