mirror of
https://github.com/getpelican/pelican.git
synced 2025-10-15 20:28:56 +02:00
add more docs about FILENAME_METADATA
This commit is contained in:
parent
fc13ae8e76
commit
070fa1ff9d
2 changed files with 22 additions and 9 deletions
|
|
@ -25,6 +25,8 @@ Release history
|
||||||
file within the same directory as the original file to prevent the server
|
file within the same directory as the original file to prevent the server
|
||||||
(e.g. Nginx) from compressing files during an HTTP call.
|
(e.g. Nginx) from compressing files during an HTTP call.
|
||||||
* Add AsciiDoc support
|
* Add AsciiDoc support
|
||||||
|
* Add ``FILENAME_METADATA`` new setting which adds support for metadata
|
||||||
|
extraction from the filename.
|
||||||
|
|
||||||
3.0 (2012-08-08)
|
3.0 (2012-08-08)
|
||||||
==================
|
==================
|
||||||
|
|
|
||||||
|
|
@ -181,15 +181,26 @@ syntax for Markdown posts should follow this pattern::
|
||||||
|
|
||||||
This is the content of my super blog post.
|
This is the content of my super blog post.
|
||||||
|
|
||||||
Note that, aside from the title, none of this metadata is mandatory: if the date
|
Note that, aside from the title, none of this metadata is mandatory: if the
|
||||||
is not specified, Pelican will rely on the file's "mtime" timestamp, and the
|
date is not specified, Pelican can rely on the file's "mtime" timestamp through
|
||||||
category can be determined by the directory in which the file resides. For
|
the ``DEFAULT_DATE`` setting, and the category can be determined by the
|
||||||
example, a file located at ``python/foobar/myfoobar.rst`` will have a category of
|
directory in which the file resides. For example, a file located at
|
||||||
``foobar``. If you would like to organize your files in other ways where the
|
``python/foobar/myfoobar.rst`` will have a category of ``foobar``. If you would
|
||||||
name of the subfolder would not be a good category name, you can set the
|
like to organize your files in other ways where the name of the subfolder would
|
||||||
setting ``USE_FOLDER_AS_CATEGORY`` to ``False``. If summary isn't given, setting
|
not be a good category name, you can set the setting ``USE_FOLDER_AS_CATEGORY``
|
||||||
``SUMMARY_MAX_LENGTH`` determines how many words from the beginning of an article
|
to ``False``. If summary isn't given, setting ``SUMMARY_MAX_LENGTH`` determines
|
||||||
are used as the summary.
|
how many words from the beginning of an article are used as the summary.
|
||||||
|
|
||||||
|
You can also extract any metadata from the filename through a regexp to be set
|
||||||
|
in the ``FILENAME_METADATA`` setting.
|
||||||
|
All named groups that are matched will be set in the metadata object. The
|
||||||
|
default value for the ``FILENAME_METADATA`` setting will only extract the date
|
||||||
|
from the filename. For example, if you would like to extract both the date and
|
||||||
|
the slug, you could set something like:
|
||||||
|
``'(?P<date>\d{4}-\d{2}-\d{2})_(?<slug>.*)'``.
|
||||||
|
|
||||||
|
Please note that the metadata available inside your files takes precedence over
|
||||||
|
the metadata extracted from the filename.
|
||||||
|
|
||||||
Generate your blog
|
Generate your blog
|
||||||
------------------
|
------------------
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue