Skip to main content

sitemapr is a library that generates sitemaps for SPA websites with declaritve configuration in Python.

Project description

sitemapr

sitemapr is a Python library designed to generate and save sitemaps for websites. It allows for the creation of detailed sitemaps with customizable parameters, making it easier for search engines to crawl and index web pages efficiently.

Features

  • Generate sitemaps with dynamic URL parameters.
  • Split large sitemaps into chunks to comply with sitemap index specifications.
  • Customizable base URLs for sitemaps and websites.

Installation

SiteMapr can be easily installed using pip. Ensure you have pip installed and run the following command:

pip install sitemapr

This command will download and install SiteMapr along with its dependencies.

Quick Start

Here's how to quickly generate a sitemap for your website using SiteMapr:

  1. Define Your Pages: First, define the pages you want to include in your sitemap, including any dynamic path or query parameters.

  2. Create a SiteMapr Instance: Initialize SiteMapr with your website's base URL and the pages you've defined.

  3. Save Your Sitemap: Choose a directory and save your sitemap, specifying chunk sizes if needed.

Example

from sitemapr import Page, Param, SiteMapr

# Define the pages of your site
pages = [
    Page(
        path="",
        query_params=[
            Param(name="page", values=["home", "about", "contact"]),
            Param(name="sort", values=["asc", "desc"]),
        ],
    ),
    Page(
        path="/blog",
        query_params=[
            Param(name="page", values=["1", "2", "3"]),
            Param(name="sort", values=["asc", "desc"]),
        ],
    ),
    Page(
        path="/blog/{id}",
        path_params=[Param(name="id", values=["1", "2", "3"])],
    ),
]

# Initialize SiteMapr with your website's base URL and the defined pages
sitemapr = SiteMapr(base_url="https://example.com", pages=pages)

# Save the sitemap to the specified directory
sitemapr.save("/path/to/your/sitemap/directory")

License

sitemapr is released under the MIT License. See the LICENSE file for more details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sitemapr-0.1.0.tar.gz (4.2 kB view details)

Uploaded Source

Built Distribution

sitemapr-0.1.0-py3-none-any.whl (4.9 kB view details)

Uploaded Python 3

File details

Details for the file sitemapr-0.1.0.tar.gz.

File metadata

  • Download URL: sitemapr-0.1.0.tar.gz
  • Upload date:
  • Size: 4.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: poetry/1.8.2 CPython/3.11.8 Linux/6.5.0-1015-azure

File hashes

Hashes for sitemapr-0.1.0.tar.gz
Algorithm Hash digest
SHA256 5ba6589f1b5628523fb2501316d166007c1b01c8b7857862d94a956e06829d5f
MD5 e24c86c5593a7f3f4c934c0b62ecd0ee
BLAKE2b-256 fc0005448a4ab4f302c6f92cb03ec28c35e44e63ec07707fd0249a15ea363f7c

See more details on using hashes here.

File details

Details for the file sitemapr-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: sitemapr-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 4.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: poetry/1.8.2 CPython/3.11.8 Linux/6.5.0-1015-azure

File hashes

Hashes for sitemapr-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 fa0cea2c22e552b29adab5bdcda7d2415083db2baa7f068639bb46094d4dcce2
MD5 84dc22afd28ef50233856dc5da87b3e6
BLAKE2b-256 050f7b3a405d19e26047f5162a4bbb77809dae8e8b6308acd4b3e901d8545189

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page