Pelican plugin to generate sitemap in plain-text or XML format
Project description
Sitemap
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
As long as you have not explicitly added a PLUGINS setting to your Pelican settings file, then the newly-installed plugin should be automatically detected and enabled. Otherwise, you must add sitemap to your existing PLUGINS list. For more information, please see the How to Use Plugins documentation.
Usage
The SITEMAP setting must be a Python dictionary and can contain these keys:
-
format, which sets the output format of the plugin (xmlortxt) -
priorities, which is a dictionary with three keys:-
articles, the priority for the URLs of the articles and their translations -
pages, the priority for the URLs of the static pages -
indexes, the priority for the URLs of the index pages, such as tags, author pages, categories indexes, archives, etc.
All the values of this dictionary must be decimal floating-point numbers between
0and1, such as0.3or0.7. -
-
changefreqs, which is a dictionary with three items:-
articles, the update frequency of the articles -
pages, the update frequency of the pages -
indexes, the update frequency of the index pages
Valid frequency values are
always,hourly,daily,weekly,monthly,yearlyandnever. -
-
exclude, which is a list of regular expressions that will be used to exclude matched URLs from the sitemap if any of them match. For example:
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:
prioritiesandchangefreqsare 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"
}
}
Using Metadata
In addition to applying a configuration to all articles/pages using the SITEMAP setting, ChangeFreq and Priority can also be specified as metadata for individual articles/pages. The same restrictions on the values apply:
- Valid options for
ChangeFreqarealways,hourly,daily,weekly,monthly,yearlyandnever. - Valid options for
Prioritymust be a decimal number between0and1.
Example
Following is an example of using sitemap-related metadata in a Markdown file:
Title: Frequently Changed Article
ChangeFreq: daily
Priority: 0.3
This is the article content.
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.
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pelican_sitemap-1.2.2.tar.gz.
File metadata
- Download URL: pelican_sitemap-1.2.2.tar.gz
- Upload date:
- Size: 8.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
93f72d035dd0ec2f5cee38b2766bbd7f6a54bf186635ae1261a6deac422dcfb7
|
|
| MD5 |
4a96e834de40d70df8dc6782c48b935f
|
|
| BLAKE2b-256 |
5cc1d9e1d539decfba947d711bcb37427ad15914557a728418bd928d56e58a32
|
Provenance
The following attestation bundles were made for pelican_sitemap-1.2.2.tar.gz:
Publisher:
main.yml on pelican-plugins/sitemap
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pelican_sitemap-1.2.2.tar.gz -
Subject digest:
93f72d035dd0ec2f5cee38b2766bbd7f6a54bf186635ae1261a6deac422dcfb7 - Sigstore transparency entry: 601254526
- Sigstore integration time:
-
Permalink:
pelican-plugins/sitemap@e0f71c2d876719f8425628ae2b9224598828ea59 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/pelican-plugins
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
main.yml@e0f71c2d876719f8425628ae2b9224598828ea59 -
Trigger Event:
push
-
Statement type:
File details
Details for the file pelican_sitemap-1.2.2-py3-none-any.whl.
File metadata
- Download URL: pelican_sitemap-1.2.2-py3-none-any.whl
- Upload date:
- Size: 8.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
09ba150dd1b54ef855f18e7ec920160d7118e932e0dac1c6e8bf3a41e938e682
|
|
| MD5 |
b80164f77e7cc8bd6819dc16446876f8
|
|
| BLAKE2b-256 |
68c2d2f98364b49a40bac9f315f29d8c22322b47bc4ebdec6a8e3a4f657ebc24
|
Provenance
The following attestation bundles were made for pelican_sitemap-1.2.2-py3-none-any.whl:
Publisher:
main.yml on pelican-plugins/sitemap
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pelican_sitemap-1.2.2-py3-none-any.whl -
Subject digest:
09ba150dd1b54ef855f18e7ec920160d7118e932e0dac1c6e8bf3a41e938e682 - Sigstore transparency entry: 601254528
- Sigstore integration time:
-
Permalink:
pelican-plugins/sitemap@e0f71c2d876719f8425628ae2b9224598828ea59 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/pelican-plugins
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
main.yml@e0f71c2d876719f8425628ae2b9224598828ea59 -
Trigger Event:
push
-
Statement type: