LocalSiteMap Package Documentation

Package documentation for LocalSiteMap. LocalSiteMap is an open-source Python package that simplifies sitemap generation by generating sitemaps using local file crawling.

Changelog

  • 1.0.0 (Latest): Initial release.

Installation

You can install LocalSiteMap using PyPi, please make sure that you are using Python 3.6 or later before installing LocalSiteMap:

pip install localsitemap

Example Usage

Generating a sitemap

from localsitemap import generate_sitemap

# Root site directory
root_directory = r"path/to/your/website/directory"

# Domain of your website (where it is hosted)
base_url_of_your_website = "https://example.com"

# List of file paths or directories to exclude from the sitemap
excluded = ["auth", "forms", "template.html", "media", ".git", ".vscode", "node_modules"]  # Example exclusions

# Generate the sitemap
generate_sitemap(root_directory, base_url_of_your_website, "sitemap.xml", excluded)
print("Sitemap generated in sitemap.xml")

Last updated

Was this helpful?