Readme.rst 907 B

12345678910111213141516171819202122232425262728293031323334353637
  1. Dateish Plugin for Pelican
  2. ==========================
  3. This plugin adds the ability to treat arbitrary metadata fields as datetime
  4. objects.
  5. Usage
  6. -----
  7. For example, if you have the following pieces of metadata in an article:
  8. .. code-block:: markdown
  9. # my_article.markdown
  10. Date: 2000-01-01
  11. Created_Date: 1999-08-04
  12. Idea_Date: 1993-03-04
  13. Normally, the Created_Date and Idea_Date variables will be strings, so you will
  14. not be able to use the strftime() Jinja filter on them.
  15. With this plugin, you define in your settings file a list of the names of
  16. the additional metadata fields you want to treat as dates:
  17. .. code-block:: python
  18. # pelicanconf.py
  19. DATEISH_PROPERTIES = ['created_date', 'idea_date']
  20. Then you can use them in templates just like date:
  21. .. code-block:: html+jinja
  22. # mytemplate.html
  23. <p>Created date: {{ article.created_date | strftime('%d %B %Y') }}</p>