francescomecca.eu/plugins/customarchiver/customarchiver.py
2018-11-10 18:19:00 +01:00

36 lines
1,023 B
Python

import glob
from nikola.plugin_categories import Task
from nikola import utils
from mako.template import Template
from mako.lookup import TemplateLookup
from nikola.utils import LOGGER
# self.site is defined in nikola.nikola.Nikola(object)
class Plugin(Task):
name = "custom_archiver_page"
def gen_tasks(self):
# This function will be called when the task is executed
def say_hi(bye):
tmpl = "customarchive.tmpl"
context = {'lang': 'en',
'title':self.site.GLOBAL_CONTEXT["blog_title"],
'archive':self.site.posts_per_year}
a = self.site.render_template(tmpl, 'output/archiveall.html', context)
return True
# Never fail because a config key is missing.
bye = self.site.config.get('BYE_WORLD', False)
# Yield a task for Doit
return {
'basename': 'custom_archiver_page',
'actions': [(say_hi, [bye])],
'uptodate': [False],
}