mirror of
https://github.com/getpelican/pelican.git
synced 2025-10-15 20:28:56 +02:00
add global license capabability as a plugin
This commit is contained in:
parent
91831eb525
commit
09567fa99e
1 changed files with 23 additions and 0 deletions
23
plugins_samples/global_license.py
Normal file
23
plugins_samples/global_license.py
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
from blinker import signal
|
||||
|
||||
"""
|
||||
License plugin for Pelican
|
||||
==========================
|
||||
|
||||
Simply add license variable in article's context, which contain
|
||||
the license text.
|
||||
|
||||
Settings:
|
||||
---------
|
||||
|
||||
Add LICENSE to your settings file to define default license.
|
||||
|
||||
"""
|
||||
|
||||
def add_license(generator, metadatas):
|
||||
if 'license' not in metadatas.keys()\
|
||||
and 'LICENSE' in self.settings.keys():
|
||||
metadatas['license'] = self.settings['LICENSE']
|
||||
|
||||
|
||||
signal('pelican_article_generate_context').connect(add_license)
|
||||
Loading…
Add table
Add a link
Reference in a new issue