Skip to content
Generate sitemaps from programmatically collected URLs.
Python Makefile
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
sitemap_builder
.gitignore
CHANGELOG.md
LICENSE
Makefile
README.md
requirements.txt
setup.py

README.md

Sitemap Builder

Generate sitemaps from programmatically collected URLs.

Features

  • Adheres to Sitemap Protocal as defined at https://www.sitemaps.org/protocol.html
  • Generates an index that points to compressed sitemaps files
  • each generated sitemap won't have more than the allowed amount (50.000 URLs)
  • jinja2 templates

Install

pip install sitemap-builder

Usage

  1. Import
from sitemap import Sitemap
  1. Initialize
sitemap = Sitemap()
  1. Add urls to process them later:
sitemap.add_item("dummy-page")
sitemap.add_item("another-page")
sitemap.add_item("category/foo-bar")
  1. Generate sitemap index and files
sitemap.generate()

Example:

Generated files:

.
├── sitemap.xml
└── sitemaps
    ├── sitemap-0.xml.gz
    ├── sitemap-1.xml.gz
    ├── sitemap-2.xml.gz
	└── sitemap-3.xml.gz

Development

Crete virtualenv

virtualenv -p /usr/bin/python3.6 ~/.virtualenvs/sitemap-builder

Activate it

workon sitemap-builder
make install
You can’t perform that action at this time.