pelican-plugins / sitemap

Generates a site map for Pelican-powered sites
49 stars 10 forks source link

Sitemap

Build Status PyPI Version License

This Pelican plugin generates a site map in plain-text or XML format. You can use the SITEMAP variable in your settings file to configure the behavior of the plugin.

Installation

This plugin can be installed via:

python -m pip install pelican-sitemap

Usage

The SITEMAP setting must be a Python dictionary and can contain these keys:

SITEMAP = {
    "exclude": [
        "^/noindex/",  # starts with "/noindex/"
        "/tag/",       # contains "/tag/"
        "\.json$",     # ends with ".json"
    ]
}

If a key is missing or a value is incorrect, it will be replaced with the default value.

You can also exclude an individual URL by adding metadata to it, setting private to True.

The sitemap is saved in: <output_path>/sitemap.<format>

Note: priorities and changefreqs are information for search engines and are only used in the XML site maps. For more information, see: https://www.sitemaps.org/protocol.html#xmlTagDefinitions

Example

Here is an example configuration (it is also the default settings):

SITEMAP = {
    "format": "xml",
    "priorities": {
        "articles": 0.5,
        "indexes": 0.5,
        "pages": 0.5
    },
    "changefreqs": {
        "articles": "monthly",
        "indexes": "daily",
        "pages": "monthly"
    }
}

Contributing

Contributions are welcome and much appreciated. Every little bit helps. You can contribute by improving the documentation, adding missing features, and fixing bugs. You can also help out by reviewing and commenting on existing issues.

To start contributing to this plugin, review the Contributing to Pelican documentation, beginning with the Contributing Code section.

License

This project is licensed under the AGPL-3.0 license.