SitemapGen

A tool to let you easily create XML sitemaps from a website's URL.

A sitemap is as crucial to planning a new website as a map is to planning a road trip. Without it, both your trip and the user's journey through your website could encounter unplanned and potentially unpleasant stops. A sitemap is a fundamental feature of your website’s search engine optimisation (SEO) strategy. So, whether you're building a website from scratch or planning an overhaul, a sitemap is essential, and this tool SitemapGen allows you to do the same without any hassle. If you are a techy, then you can use the programmable interface to generate sitemaps, or if not, the web version is always ready to help!

Installing

  • PIP: run pip install sitemapgen
  • Without PIP:
    1. Clone this repository or download it as ZIP, and open the xtracted directory in a terminal.
    2. Run python setup.py install.

Usage

CLI
  1. After you have installed the library, fire up a Terminal/Command Prompt and type sitemapgen --help. This command will show you the description of the library and the available options for using the command. For e.g.:

  2. To know the version of the tool, run sitemapgen --version
    SitemapGen v0.9.5 - By Nalin Angrish.

  3. To create a sitemap for a website, run sitemapgen --url <URL of website> --out <Path to output sitemap>. The URL specified here should not be blocked by a firewall and should be a complete URL. For example: localhost would not be valid and you would have to use http://localhost. If the output file specified does not exists, then it will be created. You can specify the output path as either a relative path to the current working directory or even an absolute path.

  4. Sometimes, when you create a sitemap for a website in development, you need to use a different domain in the sitemaps than the development domain. For example, while developing, the --url would be specified as http://localhost:port whereas, in the sitemap you might need to use a domain like http://www.example.com. In such cases, you can provide another option to the command line arguments by adding: --disguise http://www.example.com. It is always prefered to use http instead of https to avoid any future issue with the SSL certificate installation. So, the tool will automatically use the http versions of the sites.
Programatically
The library provides a Generator class that can be used to generate a sitemap of a given URL. This is an example of how to use the Generator class:


To read the code documentation, go to the official docs.


Online Sitemap Generator