mirror of
https://github.com/getpelican/pelican.git
synced 2025-10-15 20:28:56 +02:00
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
|
will not be generated with properly-formed URLs. You should
|
||||||
include ``http://`` and your domain, with no trailing
|
include ``http://`` and your domain, with no trailing
|
||||||
slash at the end. Example: ``SITEURL = 'http://mydomain.com'``
|
slash at the end. Example: ``SITEURL = 'http://mydomain.com'``
|
||||||
`STATIC_PAGES` (``None``) A mapping containing static pages that will
|
`TEMPLATE_PAGES` (``None``) A mapping containing template pages that will be rendered with
|
||||||
be rendered with the blog entries. See
|
the blog entries. See :ref:`template_pages`.
|
||||||
:ref:`static_pages`.
|
|
||||||
`STATIC_PATHS` (``['images']``) The static paths you want to have accessible
|
`STATIC_PATHS` (``['images']``) The static paths you want to have accessible
|
||||||
on the output path "static". By default,
|
on the output path "static". By default,
|
||||||
Pelican will copy the 'images' folder to the
|
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
|
.. _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
|
If you want to generate custom pages besides your blog entries, you can point
|
||||||
any HTML or HTML template file with a path pointing to the file and the
|
any Jinja2 template file with a path pointing to the file and the URL it will
|
||||||
URL it will match.
|
match.
|
||||||
|
|
||||||
For instance, if you have a blog with four static pages, for a list of
|
For instance, if you have a blog with four static pages, for a list of books,
|
||||||
books, your resume and a contact page, you could have::
|
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',
|
'/resume.html': 'static/resume.html',
|
||||||
'/contact.html': 'static/contact.html'}
|
'/contact.html': 'static/contact.html'}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Feed settings
|
Feed settings
|
||||||
=============
|
=============
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ from pelican import signals
|
||||||
from pelican.generators import (ArticlesGenerator, PagesGenerator,
|
from pelican.generators import (ArticlesGenerator, PagesGenerator,
|
||||||
StaticGenerator, PdfGenerator,
|
StaticGenerator, PdfGenerator,
|
||||||
LessCSSGenerator, SourceFileGenerator,
|
LessCSSGenerator, SourceFileGenerator,
|
||||||
StaticPageGenerator)
|
TemplatePagesGenerator)
|
||||||
from pelican.log import init
|
from pelican.log import init
|
||||||
from pelican.settings import read_settings
|
from pelican.settings import read_settings
|
||||||
from pelican.utils import (clean_output_dir, files_changed, file_changed,
|
from pelican.utils import (clean_output_dir, files_changed, file_changed,
|
||||||
|
|
@ -173,8 +173,8 @@ class Pelican(object):
|
||||||
def get_generator_classes(self):
|
def get_generator_classes(self):
|
||||||
generators = [StaticGenerator, ArticlesGenerator, PagesGenerator]
|
generators = [StaticGenerator, ArticlesGenerator, PagesGenerator]
|
||||||
|
|
||||||
if self.settings['STATIC_PAGES']:
|
if self.settings['TEMPLATE_PAGES']:
|
||||||
generators.append(StaticPageGenerator)
|
generators.append(TemplatePagesGenerator)
|
||||||
if self.settings['PDF_GENERATOR']:
|
if self.settings['PDF_GENERATOR']:
|
||||||
generators.append(PdfGenerator)
|
generators.append(PdfGenerator)
|
||||||
if self.settings['LESS_GENERATOR']: # can be True or PATH to lessc
|
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)
|
return source, path, lambda: mtime == getmtime(path)
|
||||||
|
|
||||||
|
|
||||||
class StaticPageGenerator(Generator):
|
class TemplatePagesGenerator(Generator):
|
||||||
|
|
||||||
def generate_output(self, writer):
|
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))
|
self.env.loader.loaders.insert(0, _FileLoader(source))
|
||||||
try:
|
try:
|
||||||
template = self.env.get_template(source)
|
template = self.env.get_template(source)
|
||||||
rurls = self.settings.get('RELATIVE_URLS')
|
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:
|
finally:
|
||||||
del self.env.loader.loaders[0]
|
del self.env.loader.loaders[0]
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -80,7 +80,7 @@ _DEFAULT_CONFIG = {'PATH': '.',
|
||||||
'WEBASSETS': False,
|
'WEBASSETS': False,
|
||||||
'PLUGINS': [],
|
'PLUGINS': [],
|
||||||
'MARKDOWN_EXTENSIONS': ['toc', ],
|
'MARKDOWN_EXTENSIONS': ['toc', ],
|
||||||
'STATIC_PAGES': {}
|
'TEMPLATE_PAGES': {}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue