forked from github/pelican
rename STATIC_PAGES to TEMPLATE_PAGES
This commit is contained in:
parent
083a8cc172
commit
e0e1b3eecf
4 changed files with 19 additions and 21 deletions
|
|
@ -92,9 +92,8 @@ Setting name (default value) What doe
|
|||
will not be generated with properly-formed URLs. You should
|
||||
include ``http://`` and your domain, with no trailing
|
||||
slash at the end. Example: ``SITEURL = 'http://mydomain.com'``
|
||||
`STATIC_PAGES` (``None``) A mapping containing static pages that will
|
||||
be rendered with the blog entries. See
|
||||
:ref:`static_pages`.
|
||||
`TEMPLATE_PAGES` (``None``) A mapping containing template pages that will be rendered with
|
||||
the blog entries. See :ref:`template_pages`.
|
||||
`STATIC_PATHS` (``['images']``) The static paths you want to have accessible
|
||||
on the output path "static". By default,
|
||||
Pelican will copy the 'images' folder to the
|
||||
|
|
@ -270,24 +269,22 @@ can get a list of available locales via the ``locale -a`` command; see manpage
|
|||
.. _locale(1): http://linux.die.net/man/1/locale
|
||||
|
||||
|
||||
.. _static_pages:
|
||||
.. _template_pages:
|
||||
|
||||
Static pages
|
||||
============
|
||||
Template pages
|
||||
==============
|
||||
|
||||
If you want to generate static pages besides your blog entries, you can point
|
||||
any HTML or HTML template file with a path pointing to the file and the
|
||||
URL it will match.
|
||||
If you want to generate custom pages besides your blog entries, you can point
|
||||
any Jinja2 template file with a path pointing to the file and the URL it will
|
||||
match.
|
||||
|
||||
For instance, if you have a blog with four static pages, for a list of
|
||||
books, your resume and a contact page, you could have::
|
||||
For instance, if you have a blog with four static pages, for a list of books,
|
||||
your resume and a contact page, you could have::
|
||||
|
||||
STATIC_PAGES = {'/books.html': 'static/books.html',
|
||||
TEMPLATE_PAGES = {'/books.html': 'static/books.html',
|
||||
'/resume.html': 'static/resume.html',
|
||||
'/contact.html': 'static/contact.html'}
|
||||
|
||||
|
||||
|
||||
Feed settings
|
||||
=============
|
||||
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ from pelican import signals
|
|||
from pelican.generators import (ArticlesGenerator, PagesGenerator,
|
||||
StaticGenerator, PdfGenerator,
|
||||
LessCSSGenerator, SourceFileGenerator,
|
||||
StaticPageGenerator)
|
||||
TemplatePagesGenerator)
|
||||
from pelican.log import init
|
||||
from pelican.settings import read_settings
|
||||
from pelican.utils import (clean_output_dir, files_changed, file_changed,
|
||||
|
|
@ -173,8 +173,8 @@ class Pelican(object):
|
|||
def get_generator_classes(self):
|
||||
generators = [StaticGenerator, ArticlesGenerator, PagesGenerator]
|
||||
|
||||
if self.settings['STATIC_PAGES']:
|
||||
generators.append(StaticPageGenerator)
|
||||
if self.settings['TEMPLATE_PAGES']:
|
||||
generators.append(TemplatePagesGenerator)
|
||||
if self.settings['PDF_GENERATOR']:
|
||||
generators.append(PdfGenerator)
|
||||
if self.settings['LESS_GENERATOR']: # can be True or PATH to lessc
|
||||
|
|
|
|||
|
|
@ -126,15 +126,16 @@ class _FileLoader(BaseLoader):
|
|||
return source, path, lambda: mtime == getmtime(path)
|
||||
|
||||
|
||||
class StaticPageGenerator(Generator):
|
||||
class TemplatePagesGenerator(Generator):
|
||||
|
||||
def generate_output(self, writer):
|
||||
for urlpath, source in self.settings['STATIC_PAGES'].items():
|
||||
for urlpath, source in self.settings['TEMPLATE_PAGES'].items():
|
||||
self.env.loader.loaders.insert(0, _FileLoader(source))
|
||||
try:
|
||||
template = self.env.get_template(source)
|
||||
rurls = self.settings.get('RELATIVE_URLS')
|
||||
writer.write_file(urlpath.strip('/'), template, self.context, rurls)
|
||||
writer.write_file(
|
||||
urlpath.strip('/'), template, self.context, rurls)
|
||||
finally:
|
||||
del self.env.loader.loaders[0]
|
||||
|
||||
|
|
|
|||
|
|
@ -80,7 +80,7 @@ _DEFAULT_CONFIG = {'PATH': '.',
|
|||
'WEBASSETS': False,
|
||||
'PLUGINS': [],
|
||||
'MARKDOWN_EXTENSIONS': ['toc', ],
|
||||
'STATIC_PAGES': {}
|
||||
'TEMPLATE_PAGES': {}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue