1
0
Fork 0
forked from github/pelican

Add new setting EXTRA_TEMPLATES_PATHS

This setting allow to use template which are not in the theme.
Should help to build more generic themes around the content.
This commit is contained in:
Rachid Belaid 2012-09-03 00:57:23 +01:00
commit c462237b9d
3 changed files with 10 additions and 2 deletions

View file

@ -100,6 +100,10 @@ Setting name (default value) What doe
This only applies if your content does not otherwise
specify a summary. Setting to None will cause the summary
to be a copy of the original content.
`EXTRA_TEMPLATES_PATHS` (``[]``) A list of paths you want Jinja2 to look for the templates.
Can be used to separate templates from the theme.
Example: projects, resume, profile ...
This templates need to use ``DIRECT_TEMPLATES`` setting
===================================================================== =====================================================================

View file

@ -36,8 +36,11 @@ class Generator(object):
# templates cache
self._templates = {}
self._templates_path = os.path.expanduser(
os.path.join(self.theme, 'templates'))
self._templates_path = []
self._templates_path.append(os.path.expanduser(
os.path.join(self.theme, 'templates')))
self._templates_path += self.settings.get('EXTRA_TEMPLATES_PATHS', [])
theme_path = os.path.dirname(os.path.abspath(__file__))

View file

@ -58,6 +58,7 @@ _DEFAULT_CONFIG = {'PATH': '.',
'TAG_CLOUD_STEPS': 4,
'TAG_CLOUD_MAX_ITEMS': 100,
'DIRECT_TEMPLATES': ('index', 'tags', 'categories', 'archives'),
'EXTRA_TEMPLATES_PATHS' : [],
'PAGINATED_DIRECT_TEMPLATES': ('index', ),
'PELICAN_CLASS': 'pelican.Pelican',
'DEFAULT_DATE_FORMAT': '%a %d %B %Y',