mirror of
https://github.com/getpelican/pelican.git
synced 2025-10-15 20:28:56 +02:00
Sitemap plugin & get_generators signal
This is a combination of 13 commits: 1. New signal for registering custom generators 2. New plugin: pelican.plugins.sitemap 3. pelican.plugins.sitemap: more settings 4. pelican.plugins.sitemap: translations are indexed 5. pelican.plugins.sitemap: added documentation 6. pelican.plugins.sitemap: added XML DTD & W3C dates 7. pelican.plugins.sitemap: removed a <changefreq> bug 8. the `get_generators` can now return a tuple 9. pelican.plugins.sitemap: cleaned the code 10. pelican.plugin.sitemap: settings changes 11. sitemap plugin: improved configuration & documentation 12. sitemap plugin: :set spell 13. sitemap plugin: removed useless whitespaces
This commit is contained in:
parent
88555de28c
commit
229b0e4dcc
4 changed files with 301 additions and 1 deletions
|
|
@ -59,6 +59,9 @@ Signal Arguments Description
|
|||
initialized pelican object
|
||||
article_generate_context article_generator, metadata
|
||||
article_generator_init article_generator invoked in the ArticlesGenerator.__init__
|
||||
get_generators generators invoked in Pelican.get_generator_classes,
|
||||
can return a Generator, or several
|
||||
generator in a tuple or in a list.
|
||||
pages_generate_context pages_generator, metadata
|
||||
pages_generator_init pages_generator invoked in the PagesGenerator.__init__
|
||||
========================= ============================ =========================================
|
||||
|
|
@ -108,3 +111,79 @@ variable, as in the example::
|
|||
|
||||
``github_activity`` is a list of lists. The first element is the title
|
||||
and the second element is the raw HTML from GitHub.
|
||||
|
||||
|
||||
Sitemap
|
||||
-------
|
||||
|
||||
The plugin generates a sitemap of the blog.
|
||||
It can generates plain text sitemaps or XML sitemaps.
|
||||
|
||||
Configuration
|
||||
"""""""""""""
|
||||
|
||||
You can use the setting ``SITEMAP`` variable to configure the behavior of the
|
||||
plugin.
|
||||
|
||||
The ``SITEMAP`` variable must be a Python dictionary, it can contain tree keys:
|
||||
|
||||
|
||||
- ``format``, which set the output format of the plugin (``xml`` or ``txt``)
|
||||
|
||||
- ``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`` and ``1``.
|
||||
|
||||
- ``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
|
||||
|
||||
An valid value is ``always``, ``hourly``, ``daily``, ``weekly``, ``monthly``,
|
||||
``yearly`` or ``never``.
|
||||
|
||||
|
||||
If a key is missing or a value is incorrect, it will be replaced with the
|
||||
default value.
|
||||
|
||||
The sitemap is saved in ``<output_path>/sitemap.<format>``.
|
||||
|
||||
.. note::
|
||||
``priorities`` and ``changefreqs`` are informations for search engines.
|
||||
They are only used in the XML sitemaps.
|
||||
For more information: <http://www.sitemaps.org/protocol.html#xmlTagDefinitions>
|
||||
|
||||
|
||||
Example
|
||||
"""""""
|
||||
|
||||
Here is an example of configuration (it's also the default settings):
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
PLUGINS=['pelican.plugins.sitemap',]
|
||||
|
||||
SITEMAP = {
|
||||
'format': 'xml',
|
||||
'priorities': {
|
||||
'articles': 0.5,
|
||||
'indexes': 0.5,
|
||||
'pages': 0.5
|
||||
},
|
||||
'changefreqs': {
|
||||
'articles': 'monthly',
|
||||
'indexes': 'daily',
|
||||
'pages': 'monthly'
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue