sitemapr
Generate XML sitemaps from pages, with automatic file splitting.
Installation
pip install sitemapr
Quick start
from pathlib import Path
from sitemapr import Page, SiteMapr
output = Path("sitemaps")
output.mkdir(exist_ok=True)
sitemap = SiteMapr("https://example.com")
pages = [
Page(path="/"),
Page(path="/posts/{id}", path_params={"id": ["1", "2", "3"]}),
]
sitemap.save(output, pages=pages)
Find the generated sitemap at sitemaps/sitemap.xml.
Use query_params for query strings and lastmod, changefreq, or priority for URL metadata.
Streaming pages
For large inputs, pass a generator of pages to save():
pages = (Page(path=f"/posts/{post_id}") for post_id in range(100000))
sitemap.save(output, pages=pages)
For an async iterable of pages, use asave():
await sitemap.asave(output, pages=async_pages)
License
Metadata
Release files for sitemapr 0.4.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| sitemapr-0.4.0.tar.gz | 4.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| sitemapr-0.4.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 10.5 kB
Release files / sitemapr-0.4.0.tar.gz
| Download URL | sitemapr-0.4.0.tar.gz |
|---|---|
| Size | 4.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
478047d7ddfe688b21dca5b121f2c637a0e42b61add96b2cea4ee630c2e53dbc
|
|
BLAKE2b-256 checksum How to use checksums |
d0f4f9748ade8eb90c7ad134145358bf425a9a900a8d8e5c1108dd10741143e9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
poetry/2.5.1 CPython/3.10.21 Linux/6.17.0-1022-azure
|
Release files / sitemapr-0.4.0-py3-none-any.whl
| Download URL | sitemapr-0.4.0-py3-none-any.whl |
|---|---|
| Size | 5.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
cd3d8093e5514817aa9a381f96a4b6aaae17b46a1fddc1fe255dffa71eaa98a8
|
|
BLAKE2b-256 checksum How to use checksums |
869fc7deea3c0f4a7c9b5ad10102566187268018f44dd33535dc60707f622117
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
poetry/2.5.1 CPython/3.10.21 Linux/6.17.0-1022-azure
|