global_license.py 562 B

12345678910111213141516171819
  1. """
  2. License plugin for Pelican
  3. ==========================
  4. This plugin allows you to define a LICENSE setting and adds the contents of that
  5. license variable to the article's context, making that variable available to use
  6. from within your theme's templates.
  7. """
  8. from pelican import signals
  9. def add_license(generator, metadata):
  10. if 'license' not in metadata.keys()\
  11. and 'LICENSE' in generator.settings.keys():
  12. metadata['license'] = generator.settings['LICENSE']
  13. def register():
  14. signals.article_generator_context.connect(add_license)