README.rst 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. Use Git commit to determine page date
  2. ======================================
  3. If the blog content is managed by git repo, this plugin will set articles'
  4. and pages' ``metadata['date']`` according to git commit. This plugin depends
  5. on python package ``gitpython``, install::
  6. pip install gitpython
  7. The date is determined via the following logic:
  8. * if a file is not tracked by Git, or a file is staged but never committed
  9. - metadata['date'] = filesystem time
  10. - metadata['modified'] = filesystem time
  11. * if a file is tracked, but no changes in staging area or working directory
  12. - metadata['date'] = first commit time
  13. - metadata['modified'] = last commit time
  14. * if a file is tracked, and has changes in stage area or working directory
  15. - metadata['date'] = first commit time
  16. - metadata['modified'] = filesystem time
  17. When this module is enabled, ``date`` and ``modified`` will be determined
  18. by Git status; no need to manually set in article/page metadata. And
  19. operations like copy and move will not affect the generated results.
  20. If you don't want a given article or page to use the Git time, set the
  21. metadata to ``gittime: off`` to disable it.
  22. Other options
  23. -------------
  24. ### GIT_HISTORY_FOLLOWS_RENAME (default True)
  25. You can also set GIT_HISTORY_FOLLOWS_RENAME to True in your pelican config to
  26. make the plugin follow file renames i.e. ensure the creation date matches
  27. the original file creation date, not the date is was renamed.
  28. ### GIT_GENERATE_PERMALINK (default False)
  29. Use in combination with permalink plugin to generate permalinks using the original
  30. commit sha
  31. ### GIT_SHA_METADATA (default True)
  32. Adds sha of current and oldest commit to metadata
  33. ### GIT_FILETIME_FROM_GIT (default True)
  34. Enable filetime from git behaviour
  35. Content specific options
  36. ------------------------
  37. Adding metadata `gittime` = False will prevent the plugin trying to setting filetime for this
  38. content.
  39. Adding metadata `git_permalink` = False will prevent the plugin from adding permalink for this
  40. content.
  41. FAQ
  42. ---
  43. ### Q. I get a GitCommandError: 'git rev-list ...' when I run the plugin. What's up?
  44. Be sure to use the correct gitpython module for your distros git binary.
  45. Using the GIT_HISTORY_FOLLOWS_RENAME option to True may also make your problem go away as it uses
  46. a different method to find commits.