forked from github/pelican
Minor documentation improvements
This commit is contained in:
parent
d5d821fd87
commit
85f9608ccb
2 changed files with 94 additions and 59 deletions
|
|
@ -16,6 +16,7 @@ then modified), you can specify that theme via the ``-t`` flag::
|
|||
If you'd rather not specify the theme on every invocation, you can define
|
||||
``THEME`` in your settings to point to the location of your preferred theme.
|
||||
|
||||
|
||||
Structure
|
||||
=========
|
||||
|
||||
|
|
@ -32,7 +33,7 @@ To make your own theme, you must follow the following structure::
|
|||
├── authors.html // must list all the authors
|
||||
├── categories.html // must list all the categories
|
||||
├── category.html // processed for each category
|
||||
├── index.html // the index. List all the articles
|
||||
├── index.html // the index (list all the articles)
|
||||
├── page.html // processed for each page
|
||||
├── tag.html // processed for each tag
|
||||
└── tags.html // must list all the tags. Can be a tag cloud.
|
||||
|
|
@ -45,6 +46,7 @@ To make your own theme, you must follow the following structure::
|
|||
The template files listed above are mandatory; you can add your own templates
|
||||
if it helps you keep things organized while creating your theme.
|
||||
|
||||
|
||||
Templates and variables
|
||||
=======================
|
||||
|
||||
|
|
@ -55,6 +57,7 @@ variables will be passed to each template at generation time.
|
|||
All templates will receive the variables defined in your settings file, as long
|
||||
as they are in all-caps. You can access them directly.
|
||||
|
||||
|
||||
Common variables
|
||||
----------------
|
||||
|
||||
|
|
@ -64,7 +67,7 @@ All of these settings will be available to all templates.
|
|||
Variable Description
|
||||
============= ===================================================
|
||||
output_file The name of the file currently being generated. For
|
||||
instance, when Pelican is rendering the homepage,
|
||||
instance, when Pelican is rendering the home page,
|
||||
output_file will be "index.html".
|
||||
articles The list of articles, ordered descending by date.
|
||||
All the elements are `Article` objects, so you can
|
||||
|
|
@ -81,6 +84,7 @@ categories A list of (category, articles) tuples, containing
|
|||
pages The list of pages
|
||||
============= ===================================================
|
||||
|
||||
|
||||
Sorting
|
||||
-------
|
||||
|
||||
|
|
@ -112,12 +116,13 @@ to the locale given in your settings::
|
|||
.. _datetime: http://docs.python.org/2/library/datetime.html#datetime-objects
|
||||
.. _strftime: http://docs.python.org/2/library/datetime.html#strftime-strptime-behavior
|
||||
|
||||
|
||||
index.html
|
||||
----------
|
||||
|
||||
This is the home page of your blog, generated at output/index.html.
|
||||
This is the home page or index of your blog, generated at ``index.html``.
|
||||
|
||||
If pagination is active, subsequent pages will reside in output/index`n`.html.
|
||||
If pagination is active, subsequent pages will reside in ``index{number}.html``.
|
||||
|
||||
====================== ===================================================
|
||||
Variable Description
|
||||
|
|
@ -139,14 +144,14 @@ dates_next_page The next page of articles, ordered by date,
|
|||
page_name 'index' -- useful for pagination links
|
||||
====================== ===================================================
|
||||
|
||||
|
||||
author.html
|
||||
-------------
|
||||
|
||||
This template will be processed for each of the existing authors, with
|
||||
output generated at output/author/`author_name`.html.
|
||||
|
||||
If pagination is active, subsequent pages will reside as defined by setting
|
||||
AUTHOR_SAVE_AS (`Default:` output/author/`author_name'n'`.html).
|
||||
output generated according to the ``AUTHOR_SAVE_AS`` setting (`Default:`
|
||||
``author/{author_name}.html``). If pagination is active, subsequent pages will by
|
||||
default reside at ``author/{author_name}{number}.html``.
|
||||
|
||||
====================== ===================================================
|
||||
Variable Description
|
||||
|
|
@ -173,14 +178,14 @@ page_name AUTHOR_URL where everything after `{slug}` is
|
|||
removed -- useful for pagination links
|
||||
====================== ===================================================
|
||||
|
||||
|
||||
category.html
|
||||
-------------
|
||||
|
||||
This template will be processed for each of the existing categories, with
|
||||
output generated at output/category/`category_name`.html.
|
||||
|
||||
If pagination is active, subsequent pages will reside as defined by setting
|
||||
CATEGORY_SAVE_AS (`Default:` output/category/`category_name'n'`.html).
|
||||
output generated according to the ``CATEGORY_SAVE_AS`` setting (`Default:`
|
||||
``category/{category_name}.html``). If pagination is active, subsequent pages will by
|
||||
default reside at ``category/{category_name}{number}.html``.
|
||||
|
||||
====================== ===================================================
|
||||
Variable Description
|
||||
|
|
@ -207,11 +212,14 @@ page_name CATEGORY_URL where everything after `{slug}` is
|
|||
removed -- useful for pagination links
|
||||
====================== ===================================================
|
||||
|
||||
|
||||
article.html
|
||||
-------------
|
||||
|
||||
This template will be processed for each article, with .html files saved
|
||||
as output/`article_name`.html. Here are the specific variables it gets.
|
||||
This template will be processed for each article, with
|
||||
output generated according to the ``ARTICLE_SAVE_AS`` setting (`Default:`
|
||||
``{article_name}.html``). The following variables are available when
|
||||
rendering.
|
||||
|
||||
============= ===================================================
|
||||
Variable Description
|
||||
|
|
@ -249,8 +257,10 @@ image for the Facebook open graph tags that will change for each article:
|
|||
page.html
|
||||
---------
|
||||
|
||||
This template will be processed for each page, with corresponding .html files
|
||||
saved as output/`page_name`.html.
|
||||
This template will be processed for each page, with
|
||||
output generated according to the ``PAGE_SAVE_AS`` setting (`Default:`
|
||||
``pages/{page_name}.html``). The following variables are available when
|
||||
rendering.
|
||||
|
||||
============= ===================================================
|
||||
Variable Description
|
||||
|
|
@ -259,14 +269,14 @@ page The page object to be displayed. You can access its
|
|||
title, slug, and content.
|
||||
============= ===================================================
|
||||
|
||||
|
||||
tag.html
|
||||
--------
|
||||
|
||||
This template will be processed for each tag, with corresponding .html files
|
||||
saved as output/tag/`tag_name`.html.
|
||||
|
||||
If pagination is active, subsequent pages will reside as defined in setting
|
||||
TAG_SAVE_AS (`Default:` output/tag/`tag_name'n'`.html).
|
||||
This template will be processed for each tag, with
|
||||
output generated according to the ``TAG_SAVE_AS`` setting (`Default:`
|
||||
``tag/{tag_name}.html``). If pagination is active, subsequent pages will by
|
||||
default reside at ``tag/{tag_name}{number}.html``.
|
||||
|
||||
====================== ===================================================
|
||||
Variable Description
|
||||
|
|
@ -293,12 +303,13 @@ page_name TAG_URL where everything after `{slug}` is removed
|
|||
-- useful for pagination links
|
||||
====================== ===================================================
|
||||
|
||||
|
||||
period_archives.html
|
||||
--------------------
|
||||
|
||||
This template will be processed for each year of your posts if a path
|
||||
for YEAR_ARCHIVE_SAVE_AS is defined, each month if MONTH_ARCHIVE_SAVE_AS
|
||||
is defined and each day if DAY_ARCHIVE_SAVE_AS is defined.
|
||||
for ``YEAR_ARCHIVE_SAVE_AS`` is defined, each month if ``MONTH_ARCHIVE_SAVE_AS``
|
||||
is defined, and each day if ``DAY_ARCHIVE_SAVE_AS`` is defined.
|
||||
|
||||
=================== ===================================================
|
||||
Variable Description
|
||||
|
|
@ -313,8 +324,9 @@ period A tuple of the form (`year`, `month`, `day`) that
|
|||
|
||||
=================== ===================================================
|
||||
|
||||
You can see an example of how to use `period` in the ``simple`` theme's
|
||||
period_archives.html
|
||||
You can see an example of how to use `period` in the `"simple" theme
|
||||
<https://github.com/getpelican/pelican/blob/master/pelican/themes/simple/templates/period_archives.html>`_.
|
||||
|
||||
|
||||
Feeds
|
||||
=====
|
||||
|
|
@ -346,7 +358,7 @@ missing, it will be replaced by the matching template from the ``simple`` theme.
|
|||
So if the HTML structure of a template in the ``simple`` theme is right for you,
|
||||
you don't have to write a new template from scratch.
|
||||
|
||||
You can also extend templates from the ``simple`` themes in your own themes by
|
||||
You can also extend templates from the ``simple`` theme in your own themes by
|
||||
using the ``{% extends %}`` directive as in the following example:
|
||||
|
||||
.. code-block:: html+jinja
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue