Generate a Sitemap from URL (loc) and Last Modified (lastmod) Attributes

  • Site Map Generator is an open source program used to create a customized site map with two attributes: <loc> and <lastmod>.


    It offers several options as well. The most useful is probably -b which is used to specify the file types that shouldn’t be part of the sitemap.


    • Server (or PC) with Python 3 or higher installed
    • Server (or PC) with PIP3 installed


    1. Go to this page (updated link) and copy the code.
    2. Create a file named
    ~$ touch
    1. Paste the code into
    2. Generate a sitemap.
    ~$ python3
    1. Depending on the size of the website, the command might continue to run for a few minutes. Once it has run its course, a file named sitemap.xml will be created.


    To exclude certain file types from the sitemap, use the argument -b.

    ~$ python3 -b png -b jpeg

    The above command puts all the images into the sitemap except for png and jpeg images.

Log in to reply

Suggested Topics

  • 0
  • 0
  • 0
  • 0
  • 0
  • 0
  • 0