forked from varia/varia.website
many many many Varia's websites, work in progress: https://many.vvvvvvaria.org
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
811 B
30 lines
811 B
"""
|
|
Footer Insert
|
|
"""
|
|
|
|
from pelican import signals
|
|
from pelican.contents import Content, Article
|
|
|
|
|
|
def add_footer(content):
|
|
if not isinstance(content, Article):
|
|
return
|
|
|
|
if 'FOOTER_INSERT_HTML' not in content.settings:
|
|
return
|
|
data_dict = {
|
|
'title': content.title,
|
|
'url': content.url,
|
|
'author': content.author.name,
|
|
'authors': ','.join([x.name for x in content.authors]),
|
|
'slug': content.slug,
|
|
'category': content.category,
|
|
'summary': content.summary,
|
|
}
|
|
if hasattr(content, 'date'):
|
|
data_dict['date'] = content.date
|
|
foot_insert_html = content.settings['FOOTER_INSERT_HTML'] % data_dict
|
|
content.footer_insert_html = foot_insert_html
|
|
|
|
def register():
|
|
signals.content_object_init.connect(add_footer)
|
|
|