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 (xml
ortxt
) -
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 numbers between
0
and1
. -
-
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
,yearly
andnever
. -
-
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:
priorities
andchangefreqs
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"
}
}
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
ChangeFreq
arealways
,hourly
,daily
,weekly
,monthly
,yearly
andnever
. - Valid options for
Priority
must be a decimal number between0
and1
.
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
File details
Details for the file pelican_sitemap-1.2.0.tar.gz
.
File metadata
- Download URL: pelican_sitemap-1.2.0.tar.gz
- Upload date:
- Size: 7.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d4016c9ebdf4bd87776f48fd5a36f9c3af1c3bca01cda22a83c840c9669df7e1 |
|
MD5 | 6a1a434f9f16975afe311c725f10d4ce |
|
BLAKE2b-256 | 4de551aef5c206c3e5000360f71bb04f7fe2d867afad94a993c9a60c1c6116b7 |
Provenance
The following attestation bundles were made for pelican_sitemap-1.2.0.tar.gz
:
Publisher:
main.yml
on pelican-plugins/sitemap
-
Statement type:
https://in-toto.io/Statement/v1
- Predicate type:
https://docs.pypi.org/attestations/publish/v1
- Subject name:
pelican_sitemap-1.2.0.tar.gz
- Subject digest:
d4016c9ebdf4bd87776f48fd5a36f9c3af1c3bca01cda22a83c840c9669df7e1
- Sigstore transparency entry: 146680049
- Sigstore integration time:
- Predicate type:
File details
Details for the file pelican_sitemap-1.2.0-py3-none-any.whl
.
File metadata
- Download URL: pelican_sitemap-1.2.0-py3-none-any.whl
- Upload date:
- Size: 7.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9e5bba7c98bae8e0e94c8fa72bbc49673ceaed5c5bb934e23d675572572a9fb2 |
|
MD5 | a84aee73ea1aa4f2fd902ba97154f5e3 |
|
BLAKE2b-256 | 18e497f6e1d900194d713c59752d5facc0f8b815ef6fc34faa064d6a856ffc74 |
Provenance
The following attestation bundles were made for pelican_sitemap-1.2.0-py3-none-any.whl
:
Publisher:
main.yml
on pelican-plugins/sitemap
-
Statement type:
https://in-toto.io/Statement/v1
- Predicate type:
https://docs.pypi.org/attestations/publish/v1
- Subject name:
pelican_sitemap-1.2.0-py3-none-any.whl
- Subject digest:
9e5bba7c98bae8e0e94c8fa72bbc49673ceaed5c5bb934e23d675572572a9fb2
- Sigstore transparency entry: 146680052
- Sigstore integration time:
- Predicate type: