Skip to content

A highly customizable tool to generate XML sitemaps for websites.

License

Notifications You must be signed in to change notification settings

bob-el-bot/site-mapper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Site-mapper

This is a Python tool designed to generate a sitemap XML file based on HTML files found in a specified directory. It allows customization of priorities, change frequencies, and specific page priorities through a configuration file or command-line arguments.

Installation

  1. Clone the repository:

    git clone <repository_url>
    cd sitemap-tool

Usage

Setup

The first time you run the generate command ensure you set the directory. Additionally, it is highly recommended you set the url or else it will default to https://example.com.

Commands

  • Generate Sitemap:

    Generates a sitemap XML file based on HTML files found in the specified directory.

    python sitemap_tool.py generate -d <directory> -u <base_url> [-v]

    Optional Arguments:

    • -v, --verbose: Enable verbose mode to print detailed output.
  • View Configuration:

    Displays the current configuration settings from the config.json file.

    python sitemap_tool.py view-config
  • Set Priority:

    Sets priority for a specific path in the sitemap.

    python sitemap_tool.py set-priority <path> <priority>
  • Delete Priority:

    Deletes priority for a specific path from the configuration.

    python sitemap_tool.py delete-priority
  • Set Change Frequency:

    Sets the change frequency for all URLs in the sitemap.

    python sitemap_tool.py set-changefreq <changefreq>
  • Set Specific Page Priority:

    Sets priority for a specific page identified by its path.

    python sitemap_tool.py set-specific-priority <path> <priority>
  • Delete Specific Page Priority:

    Deletes priority for a specific page from the configuration.

    python sitemap_tool.py delete-specific-priority
  • List Current Settings:

    Displays all current configuration settings.

    python sitemap_tool.py list-settings
  • Help:

    Displays usage instructions and command details.

    python sitemap_tool.py --help

Examples

  • Generate a sitemap for https://example.com using HTML files from /path/to/directory:

    python sitemap_tool.py generate -d /path/to/directory -u https://example.com
  • Set priority 0.8 for path /blog/:

    python sitemap_tool.py set-priority /blog/ 0.8
  • View current configuration settings:

    python sitemap_tool.py view-config

Configuration File (config.json)

The config.json file contains the following configuration options:

{
  "directory": "/path/to/your/default/directory",
  "base_url": "https://example.com",
  "priorities": {},
  "changefreq": "monthly",
  "specific_pages": {}
}
  • directory: Default directory where HTML files are located.
  • base_url: Base URL used to construct URLs in the sitemap.
  • priorities: Custom priority settings for specific paths.
  • changefreq: Default change frequency for all URLs in the sitemap.
  • specific_pages: Specific priority settings for individual pages.

License

This project is licensed under the MIT License - see the LICENSE file for details.

About

A highly customizable tool to generate XML sitemaps for websites.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages