Skip to content
This repository has been archived by the owner on Jul 7, 2023. It is now read-only.

A simple Python module to create XML sitemaps with support for sitemap indexes for very large maps.

License

Notifications You must be signed in to change notification settings

r0yfire/python-sitemap-generator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

python-sitemap-generator

A simple Python module to create XML sitemaps with support for sitemap index files.

pysitemapgen will create appropriate sitemap index files (to group multiple sitemap files) for maps with more than 50,000 URLs.

For more details about Sitemap index files, see:

Example usage:

from pysitemapgen import Sitemap

sm=Sitemap(changefreq='weekly', sitemap_url='http://example.com/')

for x in range(1,150000):
  sm.add('http://www.example.com/page-%s.html' %x,
        changefreq='daily',
        priority=0.7,
        lastmod='2015-27-01')

sm.write('sitemap')

You should get 4 files for the example above:

sitemap.xml  sitemap1.xml  sitemap2.xml  sitemap3.xml

Contents of sitemap.xml:

<?xml version='1.0' encoding='UTF-8'?>
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
    <sitemap>
        <loc>http://example.com/sitemap1.xml</loc>
        <lastmod>2015-01-26</lastmod>
    </sitemap>
    <sitemap>
        <loc>http://example.com/sitemap2.xml</loc>
        <lastmod>2015-01-26</lastmod>
    </sitemap>
    <sitemap>
        <loc>http://example.com/sitemap3.xml</loc>
        <lastmod>2015-01-26</lastmod>
    </sitemap>
</sitemapindex>

About

A simple Python module to create XML sitemaps with support for sitemap indexes for very large maps.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages