mirror of
https://github.com/getpelican/pelican.git
synced 2025-10-15 20:28:56 +02:00
merge with master
This commit is contained in:
commit
93c04cd79f
166 changed files with 4437 additions and 2285 deletions
129
docs/changelog.rst
Normal file
129
docs/changelog.rst
Normal file
|
|
@ -0,0 +1,129 @@
|
|||
Release history
|
||||
###############
|
||||
|
||||
3.1 (XXXX-XX-XX)
|
||||
================
|
||||
|
||||
* Improve handling of links to intra-site resources
|
||||
|
||||
3.0 (2012-08-08)
|
||||
==================
|
||||
|
||||
* Refactored the way URLs are handled
|
||||
* Improved the English documentation
|
||||
* Fixed packaging using ``setuptools`` entrypoints
|
||||
* Added ``typogrify`` support
|
||||
* Added a way to disable feed generation
|
||||
* Added support for ``DIRECT_TEMPLATES``
|
||||
* Allow multiple extensions for content files
|
||||
* Added LESS support
|
||||
* Improved the import script
|
||||
* Added functional tests
|
||||
* Rsync support in the generated Makefile
|
||||
* Improved feed support (easily pluggable with Feedburner for instance)
|
||||
* Added support for ``abbr`` in reST
|
||||
* Fixed a bunch of bugs :-)
|
||||
|
||||
2.8 (2012-02-28)
|
||||
==================
|
||||
|
||||
* Dotclear importer
|
||||
* Allow the usage of Markdown extensions
|
||||
* Themes are now easily extensible
|
||||
* Don't output pagination information if there is only one page
|
||||
* Add a page per author, with all their articles
|
||||
* Improved the test suite
|
||||
* Made the themes easier to extend
|
||||
* Removed Skribit support
|
||||
* Added a ``pelican-quickstart`` script
|
||||
* Fixed timezone-related issues
|
||||
* Added some scripts for Windows support
|
||||
* Date can be specified in seconds
|
||||
* Never fail when generating posts (skip and continue)
|
||||
* Allow the use of future dates
|
||||
* Support having different timezones per language
|
||||
* Enhanced the documentation
|
||||
|
||||
2.7 (2011-06-11)
|
||||
==================
|
||||
|
||||
* Use ``logging`` rather than echoing to stdout
|
||||
* Support custom Jinja filters
|
||||
* Compatibility with Python 2.5
|
||||
* Added a theme manager
|
||||
* Packaged for Debian
|
||||
* Added draft support
|
||||
|
||||
2.6 (2011-03-08)
|
||||
==================
|
||||
|
||||
* Changes in the output directory structure
|
||||
* Makes templates easier to work with / create
|
||||
* Added RSS support (was Atom-only)
|
||||
* Added tag support for the feeds
|
||||
* Enhance the documentation
|
||||
* Added another theme (brownstone)
|
||||
* Added translations
|
||||
* Added a way to use cleaner URLs with a rewrite url module (or equivalent)
|
||||
* Added a tag cloud
|
||||
* Added an autoreloading feature: the blog is automatically regenerated each time a modification is detected
|
||||
* Translate the documentation into French
|
||||
* Import a blog from an RSS feed
|
||||
* Pagination support
|
||||
* Added Skribit support
|
||||
|
||||
2.5 (2010-11-20)
|
||||
==================
|
||||
|
||||
* Import from Wordpress
|
||||
* Added some new themes (martyalchin / wide-notmyidea)
|
||||
* First bug report!
|
||||
* Linkedin support
|
||||
* Added a FAQ
|
||||
* Google Analytics support
|
||||
* Twitter support
|
||||
* Use relative URLs, not static ones
|
||||
|
||||
2.4 (2010-11-06)
|
||||
================
|
||||
|
||||
* Minor themes changes
|
||||
* Add Disqus support (so we have comments)
|
||||
* Another code refactoring
|
||||
* Added config settings about pages
|
||||
* Blog entries can also be generated in PDF
|
||||
|
||||
2.3 (2010-10-31)
|
||||
================
|
||||
|
||||
* Markdown support
|
||||
|
||||
2.2 (2010-10-30)
|
||||
================
|
||||
|
||||
* Prettify output
|
||||
* Manages static pages as well
|
||||
|
||||
2.1 (2010-10-30)
|
||||
================
|
||||
|
||||
* Make notmyidea the default theme
|
||||
|
||||
2.0 (2010-10-30)
|
||||
================
|
||||
|
||||
* Refactoring to be more extensible
|
||||
* Change into the setting variables
|
||||
|
||||
1.2 (2010-09-28)
|
||||
================
|
||||
|
||||
* Added a debug option
|
||||
* Added per-category feeds
|
||||
* Use filesystem to get dates if no metadata is provided
|
||||
* Add Pygments support
|
||||
|
||||
1.1 (2010-08-19)
|
||||
================
|
||||
|
||||
* First working version
|
||||
|
|
@ -24,7 +24,7 @@ html_theme = 'pelican'
|
|||
html_theme_options = {
|
||||
'nosidebar': True,
|
||||
'index_logo': 'pelican.png',
|
||||
'github_fork': 'ametaireau/pelican',
|
||||
'github_fork': 'getpelican/pelican',
|
||||
}
|
||||
|
||||
html_static_path = ['_static']
|
||||
|
|
|
|||
|
|
@ -3,14 +3,17 @@ How to contribute?
|
|||
There are many ways to contribute to Pelican. You can enhance the
|
||||
documentation, add missing features, and fix bugs (or just report them).
|
||||
|
||||
Don't hesitate to fork and make a pull request on GitHub.
|
||||
Don't hesitate to fork and make a pull request on GitHub. When doing so, please
|
||||
create a new feature branch as opposed to making your commits in the master
|
||||
branch.
|
||||
|
||||
Setting up the development environment
|
||||
======================================
|
||||
|
||||
You're free to set up your development environment any way you like. Here is a
|
||||
way using virtualenv and virtualenvwrapper. If you don't have them, you can
|
||||
install these packages via::
|
||||
way using the `virtualenv <http://www.virtualenv.org/>`_ and `virtualenvwrapper
|
||||
<http://www.doughellmann.com/projects/virtualenvwrapper/>`_ tools. If you don't
|
||||
have them, you can install these both of these packages via::
|
||||
|
||||
$ pip install virtualenvwrapper
|
||||
|
||||
|
|
@ -20,30 +23,47 @@ different projects.
|
|||
|
||||
To create a virtual environment, use the following syntax::
|
||||
|
||||
$ mkvirtualenv pelican
|
||||
$ mkvirtualenv pelican
|
||||
|
||||
To manually install the dependencies::
|
||||
To clone the Pelican source::
|
||||
|
||||
$ git clone https://github.com/getpelican/pelican.git src/pelican
|
||||
|
||||
To install the development dependencies::
|
||||
|
||||
$ cd src/pelican
|
||||
$ pip install -r dev_requirements.txt
|
||||
|
||||
To install Pelican and its dependencies::
|
||||
|
||||
$ python setup.py develop
|
||||
|
||||
Running the test suite
|
||||
======================
|
||||
|
||||
Each time you add a feature, there are two things to do regarding tests:
|
||||
checking that the existing tests pass, and adding tests for your new feature
|
||||
or for the bug you're fixing.
|
||||
checking that the existing tests pass, and adding tests for the new feature
|
||||
or bugfix.
|
||||
|
||||
The tests live in "pelican/tests" and you can run them using the
|
||||
"discover" feature of unittest2::
|
||||
|
||||
$ unit2 discover
|
||||
|
||||
If you have made changes that affect the output of a Pelican-generated weblog,
|
||||
then you should update the output used by functional tests.
|
||||
To do so, you can use the following two commands::
|
||||
|
||||
$ LC_ALL="C" pelican -o tests/output/custom/ -s samples/pelican.conf.py \
|
||||
samples/content/
|
||||
$ LC_ALL="C" USER="Dummy Author" pelican -o tests/output/basic/ samples/content/
|
||||
|
||||
Coding standards
|
||||
================
|
||||
|
||||
Try to respect what is described in the PEP8
|
||||
(http://www.python.org/dev/peps/pep-0008/) when providing patches. This can be
|
||||
eased by the pep8 tool (http://pypi.python.org/pypi/pep8) or by Flake8, which
|
||||
will give you some other cool hints about what's good or wrong
|
||||
(http://pypi.python.org/pypi/flake8/)
|
||||
Try to respect what is described in the `PEP8 specification
|
||||
<http://www.python.org/dev/peps/pep-0008/>`_ when providing patches. This can be
|
||||
eased via the `pep8 <http://pypi.python.org/pypi/pep8>`_ or `flake8
|
||||
<http://pypi.python.org/pypi/flake8/>`_ tools, the latter of which in
|
||||
particular will give you some useful hints about ways in which the
|
||||
code/formatting can be improved.
|
||||
|
|
|
|||
107
docs/faq.rst
107
docs/faq.rst
|
|
@ -3,19 +3,47 @@ Frequently Asked Questions (FAQ)
|
|||
|
||||
Here is a summary of the frequently asked questions for Pelican.
|
||||
|
||||
What's the best way to communicate a problem, question, or suggestion?
|
||||
======================================================================
|
||||
|
||||
If you have a problem, question, or suggestion, please start by striking up a
|
||||
conversation on `#pelican on Freenode <irc://irc.freenode.net/pelican>`_.
|
||||
Those who don't have an IRC client handy can jump in immediately via
|
||||
`IRC webchat <http://webchat.freenode.net/?channels=pelican&uio=d4>`_. Because
|
||||
of differing time zones, you may not get an immediate response to your question,
|
||||
but please be patient and stay logged into IRC — someone will almost always
|
||||
respond.
|
||||
|
||||
If you are unable to resolve your issue or if you have a feature request, please
|
||||
refer to the `issue tracker <https://github.com/getpelican/pelican/issues>`_.
|
||||
|
||||
How can I help?
|
||||
================
|
||||
|
||||
There are several ways to help out. First, you can use Pelican and report any
|
||||
suggestions or problems you might have via IRC or the issue tracker.
|
||||
|
||||
If you want to contribute, please fork `the git repository
|
||||
<https://github.com/getpelican/pelican/>`_, create a new feature branch, make
|
||||
your changes, and issue a pull request. Someone will review your changes as soon
|
||||
as possible. Please refer to the :doc:`How to Contribute <contribute>` section
|
||||
for more details.
|
||||
|
||||
You can also contribute by creating themes and improving the documentation.
|
||||
|
||||
Is it mandatory to have a configuration file?
|
||||
=============================================
|
||||
|
||||
No, it's not. Configuration files are just an easy way to configure Pelican.
|
||||
For basic operations, it's possible to specify options while invoking Pelican
|
||||
via the command line. See `pelican --help` for more information.
|
||||
via the command line. See ``pelican --help`` for more information.
|
||||
|
||||
I'm creating my own theme. How do I use Pygments for syntax highlighting?
|
||||
=========================================================================
|
||||
|
||||
Pygments adds some classes to the generated content. These classes are used by
|
||||
themes to style code syntax highlighting via CSS. Specifically, you can
|
||||
customize the appearance of your syntax highlighting via the `.codehilite pre`
|
||||
customize the appearance of your syntax highlighting via the ``.codehilite pre``
|
||||
class in your theme's CSS file. To see how various styles can be used to render
|
||||
Django code, for example, you can use the demo `on the project website
|
||||
<http://pygments.org/demo/15101/>`_.
|
||||
|
|
@ -25,19 +53,6 @@ How do I create my own theme?
|
|||
|
||||
Please refer to :ref:`theming-pelican`.
|
||||
|
||||
How can I help?
|
||||
================
|
||||
|
||||
There are several ways to help out. First, you can use Pelican and report any
|
||||
suggestions or problems you might have on `the bugtracker
|
||||
<http://github.com/ametaireau/pelican/issues>`_.
|
||||
|
||||
If you want to contribute, please fork `the git repository
|
||||
<https://github.com/ametaireau/pelican/>`_, make your changes, and issue
|
||||
a pull request. I'll review your changes as soon as possible.
|
||||
|
||||
You can also contribute by creating themes and improving the documentation.
|
||||
|
||||
I want to use Markdown, but I got an error.
|
||||
===========================================
|
||||
|
||||
|
|
@ -49,3 +64,65 @@ install it. You can do so by typing::
|
|||
In case you don't have pip installed, consider installing it via::
|
||||
|
||||
$ (sudo) easy_install pip
|
||||
|
||||
Can I use arbitrary meta-data in my templates?
|
||||
==============================================
|
||||
|
||||
Yes. For example, to include a modified date in a Markdown post, one could
|
||||
include the following at the top of the article::
|
||||
|
||||
Modified: 2012-08-08
|
||||
|
||||
That meta-data can then be accessed in the template::
|
||||
|
||||
{% if article.modified %}
|
||||
Last modified: {{ article.modified }}
|
||||
{% endif %}
|
||||
|
||||
How do I assign custom templates on a per-page basis?
|
||||
=====================================================
|
||||
|
||||
It's as simple as adding an extra line of metadata to any pages or articles you
|
||||
want to have its own template.
|
||||
|
||||
:template: template_name
|
||||
|
||||
Then just make sure to have the template installed in to your theme as
|
||||
``template_name.html``.
|
||||
|
||||
What if I want to disable feed generation?
|
||||
==========================================
|
||||
|
||||
To disable all feed generation set ``FEED_ATOM`` and ``FEED_RSS`` to ``None`` in
|
||||
your settings. Please note ``None`` and ``''`` are not the same thing. The
|
||||
word ``None`` should not be surrounded by quotes.
|
||||
|
||||
I'm getting a warning about feeds generated without SITEURL being set properly
|
||||
==============================================================================
|
||||
|
||||
`RSS and Atom feeds require all URLs and links in them to be absolute
|
||||
<http://validator.w3.org/feed/docs/rss2.html#comments>`_.
|
||||
In order to properly generate all URLs properly in Pelican you will need to set
|
||||
``SITEURL`` to the full path of your blog. When using ``make html`` and the
|
||||
default Makefile provided by the `pelican-quickstart` bootstrap script to test
|
||||
build your site, it's normal to see this warning since ``SITEURL`` is
|
||||
deliberately left undefined. If configured properly no other ``make`` commands
|
||||
should result in this warning.
|
||||
|
||||
Feeds are still generated when this warning is displayed but may not validate.
|
||||
|
||||
My feeds are broken since I upgraded to Pelican 3.0
|
||||
===================================================
|
||||
|
||||
Starting in 3.0, some of the FEED setting names were changed to more explicitly
|
||||
refer to the Atom feeds they inherently represent (much like the FEED_RSS
|
||||
setting names). Here is an exact list of the renamed setting names::
|
||||
|
||||
FEED -> FEED_ATOM
|
||||
TAG_FEED -> TAG_FEED_ATOM
|
||||
CATEGORY_FEED -> CATEGORY_FEED_ATOM
|
||||
|
||||
Older 2.x themes that referenced the old setting names may not link properly.
|
||||
In order to rectify this, please update your theme for compatibility with 3.0+
|
||||
by changing the relevant values in your template files. For an example of
|
||||
complete feed headers and usage please check out the ``simple`` theme.
|
||||
|
|
|
|||
|
|
@ -52,19 +52,19 @@ détails au prochain chapitre.
|
|||
Flux de syndication
|
||||
===================
|
||||
|
||||
CATEGORY_FEED :
|
||||
CATEGORY_FEED_ATOM :
|
||||
Chemin d’écriture des flux Atom liés aux catégories ;
|
||||
|
||||
CATEGORY_FEED_RSS :
|
||||
Idem pour les flux rss (Optionnel);
|
||||
|
||||
FEED :
|
||||
FEED_ATOM :
|
||||
Chemin du flux Atom global ;
|
||||
|
||||
FEED_RSS :
|
||||
Chemin du flux Rss global (Optionnel);
|
||||
|
||||
TAG_FEED :
|
||||
TAG_FEED_ATOM :
|
||||
Chemin des flux Atom pour les tags (Optionnel);
|
||||
|
||||
TAG_FEED_RSS :
|
||||
|
|
@ -77,8 +77,11 @@ Traductions
|
|||
DEFAULT_LANG :
|
||||
Le langage par défaut à utiliser. «*en*» par défaut ;
|
||||
|
||||
TRANSLATION_FEED :
|
||||
Chemin du flux pour les traductions.
|
||||
TRANSLATION_FEED_ATOM :
|
||||
Chemin du flux Atom pour les traductions.
|
||||
|
||||
TRANSLATION_FEED_RSS :
|
||||
Chemin du flux RSS pour les traductions.
|
||||
|
||||
|
||||
Thèmes
|
||||
|
|
@ -111,7 +114,7 @@ LINKS :
|
|||
PDF_PROCESSOR :
|
||||
Génère ou non les articles et pages au format pdf ;
|
||||
|
||||
REVERSE_ARCHIVE_ORDER :
|
||||
NEWEST_FIRST_ARCHIVES :
|
||||
Met les articles plus récent en tête de l'archive ;
|
||||
|
||||
SOCIAL :
|
||||
|
|
@ -133,8 +136,12 @@ Pelican est fournit avec :doc:`pelican-themes`, un script permettant de gérer l
|
|||
Paramètres divers
|
||||
=================
|
||||
|
||||
FALLBACK_ON_FS_DATE :
|
||||
Si *True*, Pelican se basera sur le *mtime* du fichier s'il n'y a pas de date spécifiée dans le fichier de l'article ;
|
||||
DEFAULT_DATE:
|
||||
Date par défaut à utiliser si l'information de date n'est pas spécifiée
|
||||
dans les metadonnées de l'article.
|
||||
Si 'fs', Pelican se basera sur le *mtime* du fichier.
|
||||
Si c'est un tuple, il sera passé au constructeur datetime.datetime pour
|
||||
générer l'objet datetime utilisé par défaut.
|
||||
|
||||
KEEP_OUTPUT DIRECTORY :
|
||||
Ne génère que les fichiers modifiés et n'efface pas le repertoire de sortie ;
|
||||
|
|
@ -151,7 +158,5 @@ SITEURL :
|
|||
STATIC_PATHS :
|
||||
Les chemins statiques que vous voulez avoir accès sur le chemin de sortie "statique" ;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
MARKDOWN_EXTENSIONS :
|
||||
Liste des extentions Markdown que vous souhaitez utiliser ;
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ Code source
|
|||
===========
|
||||
|
||||
Vous pouvez accéder au code source via git à l'adresse
|
||||
http://github.com/ametaireau/pelican/
|
||||
http://github.com/getpelican/pelican/
|
||||
|
||||
Feedback !
|
||||
==========
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ Pour installer Pelican en reprenant le code via Github, nous aurons besoin du pa
|
|||
git-core pour récupérez les sources de Pelican. Puis nous procédons à l’installation ::
|
||||
|
||||
# apt-get install git-core
|
||||
$ git clone https://github.com/ametaireau/pelican.git
|
||||
$ git clone https://github.com/getpelican/pelican.git
|
||||
$ cd pelican
|
||||
# python setup.py install
|
||||
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ Pelican utlise le très bon moteur de template `jinja2 <http://jinja.pocoo.org>`
|
|||
pour produire de l'HTML. La syntaxe de jinja2 est vraiment très simple. Si vous
|
||||
voulez créer votre propre thème, soyez libre de prendre inspiration sur le theme
|
||||
"simple" qui est disponible `ici
|
||||
<https://github.com/ametaireau/pelican/tree/master/pelican/themes/simple/templates>`_
|
||||
<https://github.com/getpelican/pelican/tree/master/pelican/themes/simple/templates>`_
|
||||
|
||||
Structure
|
||||
=========
|
||||
|
|
|
|||
|
|
@ -1,29 +1,32 @@
|
|||
Getting started
|
||||
###############
|
||||
|
||||
Installing
|
||||
==========
|
||||
Installing Pelican
|
||||
==================
|
||||
|
||||
You're ready? Let's go! You can install Pelican via several different methods.
|
||||
The simplest is via `pip <http://www.pip-installer.org/>`_::
|
||||
|
||||
$ pip install pelican
|
||||
|
||||
If you don't have pip installed, an alternative method is easy_install::
|
||||
If you don't have ``pip`` installed, an alternative method is ``easy_install``::
|
||||
|
||||
$ easy_install pelican
|
||||
|
||||
While the above is the simplest method, the recommended approach is to create
|
||||
a virtual environment for Pelican via `virtualenv <http://www.virtualenv.org/>`_
|
||||
and `virtualenvwrapper <http://www.doughellmann.com/projects/virtualenvwrapper/>`_
|
||||
before installing Pelican::
|
||||
a virtual environment for Pelican via virtualenv_ and virtualenvwrapper_ before
|
||||
installing Pelican. Assuming you've followed the virtualenvwrapper
|
||||
`installation <http://virtualenvwrapper.readthedocs.org/en/latest/install.html>`_
|
||||
and `shell configuration
|
||||
<http://virtualenvwrapper.readthedocs.org/en/latest/install.html#shell-startup-file>`_
|
||||
steps, you can then open a new terminal session and create a new virtual
|
||||
environment for Pelican::
|
||||
|
||||
$ pip install virtualenvwrapper
|
||||
$ mkvirtualenv pelican
|
||||
|
||||
Once the virtual environment has been created and activated, Pelican can be
|
||||
be installed via pip or easy_install as noted above. Alternatively, if you
|
||||
have the project source, you can install Pelican using the distutils
|
||||
be installed via ``pip`` or ``easy_install`` as noted above. Alternatively, if
|
||||
you have the project source, you can install Pelican using the distutils
|
||||
method::
|
||||
|
||||
$ cd path-to-Pelican-source
|
||||
|
|
@ -32,14 +35,19 @@ method::
|
|||
If you have Git installed and prefer to install the latest bleeding-edge
|
||||
version of Pelican rather than a stable release, use the following command::
|
||||
|
||||
$ pip install -e git://github.com/ametaireau/pelican#egg=pelican
|
||||
$ pip install -e git://github.com/getpelican/pelican#egg=pelican
|
||||
|
||||
If you plan on using Markdown as a markup format, you'll need to install the
|
||||
Markdown library as well::
|
||||
|
||||
$ pip install Markdown
|
||||
|
||||
Upgrading
|
||||
---------
|
||||
|
||||
If you installed a stable Pelican release via pip or easy_install and wish to
|
||||
upgrade to the latest stable release, you can do so by adding `--upgrade` to
|
||||
the relevant command. For pip, that would be::
|
||||
If you installed a stable Pelican release via ``pip`` or ``easy_install`` and
|
||||
wish to upgrade to the latest stable release, you can do so by adding
|
||||
``--upgrade`` to the relevant command. For pip, that would be::
|
||||
|
||||
$ pip install --upgrade pelican
|
||||
|
||||
|
|
@ -55,12 +63,76 @@ At this time, Pelican is dependent on the following Python packages:
|
|||
* jinja2, for templating support
|
||||
* docutils, for supporting reStructuredText as an input format
|
||||
|
||||
If you're not using Python 2.7, you will also need `argparse`.
|
||||
If you're not using Python 2.7, you will also need the ``argparse`` package.
|
||||
|
||||
Optionally:
|
||||
|
||||
* pygments, for syntax highlighting
|
||||
* Markdown, for supporting Markdown as an input format
|
||||
* Typogrify, for typographical enhancements
|
||||
|
||||
Kickstart a blog
|
||||
================
|
||||
|
||||
Following is a brief tutorial for those who want to get started right away.
|
||||
We're going to assume that virtualenv_ and virtualenvwrapper_ are installed and
|
||||
configured; if you've installed Pelican outside of a virtual environment,
|
||||
you can skip to the ``pelican-quickstart`` command. Let's first create a new
|
||||
virtual environment and install Pelican into it::
|
||||
|
||||
$ mkvirtualenv pelican
|
||||
$ pip install pelican Markdown
|
||||
|
||||
Next we'll create a directory to house our site content and configuration files,
|
||||
which can be located any place you prefer, and associate this new project with
|
||||
the currently-active virtual environment::
|
||||
|
||||
$ mkdir ~/code/yoursitename
|
||||
$ cd ~/code/yoursitename
|
||||
$ setvirtualenvproject
|
||||
|
||||
Now we can run the ``pelican-quickstart`` command, which will ask some questions
|
||||
about your site::
|
||||
|
||||
$ pelican-quickstart
|
||||
|
||||
Once you finish answering all the questions, you can begin adding content to the
|
||||
*content* folder that has been created for you. (See *Writing articles using
|
||||
Pelican* section below for more information about how to format your content.)
|
||||
Once you have some content to generate, you can convert it to HTML via the
|
||||
following command::
|
||||
|
||||
$ make html
|
||||
|
||||
If you'd prefer to have Pelican automatically regenerate your site every time a
|
||||
change is detected (handy when testing locally), use the following command
|
||||
instead::
|
||||
|
||||
$ make regenerate
|
||||
|
||||
To serve the site so it can be previewed in your browser at
|
||||
http://localhost:8000::
|
||||
|
||||
$ make serve
|
||||
|
||||
Normally you would need to run ``make regenerate`` and ``make serve`` in two
|
||||
separate terminal sessions, but you can run both at once via::
|
||||
|
||||
$ make devserver
|
||||
|
||||
The above command will simultaneously run Pelican in regeneration mode as well
|
||||
as serve the output at http://localhost:8000. Once you are done testing your
|
||||
changes, you should stop the development server via::
|
||||
|
||||
$ ./develop_server.sh stop
|
||||
|
||||
When you're ready to publish your site, you can upload it via the method(s) you
|
||||
chose during the ``pelican-quickstart`` questionnaire. For this example, we'll
|
||||
use rsync over ssh::
|
||||
|
||||
$ make rsync_upload
|
||||
|
||||
That's it! Your site should now be live.
|
||||
|
||||
Writing articles using Pelican
|
||||
==============================
|
||||
|
|
@ -73,7 +145,7 @@ file system (for instance, about the category of your articles), but some
|
|||
information you need to provide in the form of metadata inside your files.
|
||||
|
||||
You can provide this metadata in reStructuredText text files via the
|
||||
following syntax (give your file the `.rst` extension)::
|
||||
following syntax (give your file the ``.rst`` extension)::
|
||||
|
||||
My super title
|
||||
##############
|
||||
|
|
@ -83,10 +155,14 @@ following syntax (give your file the `.rst` extension)::
|
|||
:category: yeah
|
||||
:author: Alexis Metaireau
|
||||
|
||||
Pelican implements an extension of reStructuredText to enable support for the
|
||||
``abbr`` HTML tag. To use it, write something like this in your post::
|
||||
|
||||
You can also use Markdown syntax (with a file ending in `.md`).
|
||||
Markdown generation will not work until you explicitly install the `Markdown`
|
||||
package, which can be done via `pip install Markdown`. Metadata syntax for
|
||||
This will be turned into :abbr:`HTML (HyperText Markup Language)`.
|
||||
|
||||
You can also use Markdown syntax (with a file ending in ``.md``).
|
||||
Markdown generation will not work until you explicitly install the ``Markdown``
|
||||
package, which can be done via ``pip install Markdown``. Metadata syntax for
|
||||
Markdown posts should follow this pattern::
|
||||
|
||||
Date: 2010-12-03
|
||||
|
|
@ -99,54 +175,59 @@ Markdown posts should follow this pattern::
|
|||
Note that, aside from the title, none of this metadata is mandatory: if the date
|
||||
is not specified, Pelican will rely on the file's "mtime" timestamp, and the
|
||||
category can be determined by the directory in which the file resides. For
|
||||
example, a file located at `python/foobar/myfoobar.rst` will have a category of
|
||||
`foobar`.
|
||||
example, a file located at ``python/foobar/myfoobar.rst`` will have a category of
|
||||
``foobar``.
|
||||
|
||||
Generate your blog
|
||||
------------------
|
||||
|
||||
To launch Pelican, just use the `pelican` command::
|
||||
The ``make`` shortcut commands mentioned in the ``Kickstart a blog`` section
|
||||
are mostly wrappers around the ``pelican`` command that generates the HTML from
|
||||
the content. The ``pelican`` command can also be run directly::
|
||||
|
||||
$ pelican /path/to/your/content/ [-s path/to/your/settings.py]
|
||||
|
||||
And… that's all! Your weblog will be generated and saved in the `content/`
|
||||
folder.
|
||||
The above command will generate your weblog and save it in the ``output/``
|
||||
folder, using the default theme to produce a simple site. The default theme is
|
||||
simple HTML without styling and is provided so folks may use it as a basis for
|
||||
creating their own themes.
|
||||
|
||||
The above command will use the default theme to produce a simple site. It's not
|
||||
very sexy, as it's just simple HTML output (without any style).
|
||||
|
||||
You can create your own style if you want. Have a look at the help to see all
|
||||
the options you can use::
|
||||
Pelican has other command-line switches available. Have a look at the help to
|
||||
see all the options you can use::
|
||||
|
||||
$ pelican --help
|
||||
|
||||
Kickstart a blog
|
||||
----------------
|
||||
Auto-reload
|
||||
-----------
|
||||
|
||||
You also can use the `pelican-quickstart` script to start a new blog in
|
||||
seconds by just answering a few questions. Just run `pelican-quickstart` and
|
||||
you're done! (Added in Pelican 3.0)
|
||||
It's possible to tell Pelican to watch for your modifications, instead of
|
||||
manually re-running it every time you want to see your changes. To enable this,
|
||||
run the ``pelican`` command with the ``-r`` or ``--autoreload`` option.
|
||||
|
||||
Pages
|
||||
-----
|
||||
|
||||
If you create a folder named `pages`, all the files in it will be used to
|
||||
If you create a folder named ``pages``, all the files in it will be used to
|
||||
generate static pages.
|
||||
|
||||
Then, use the `DISPLAY_PAGES_ON_MENU` setting, which will add all the pages to
|
||||
Then, use the ``DISPLAY_PAGES_ON_MENU`` setting, which will add all the pages to
|
||||
the menu.
|
||||
|
||||
If you want to exclude any pages from being linked to or listed in the menu
|
||||
then add a ``status: hidden`` attribute to its metadata. This is useful for
|
||||
things like making error pages that fit the generated theme of your site.
|
||||
|
||||
Importing an existing blog
|
||||
--------------------------
|
||||
|
||||
It is possible to import your blog from Dotclear, WordPress, and RSS feeds using
|
||||
It is possible to import your blog from Dotclear, WordPress, and RSS feeds using
|
||||
a simple script. See :ref:`import`.
|
||||
|
||||
Translations
|
||||
------------
|
||||
|
||||
It is possible to translate articles. To do so, you need to add a `lang` meta
|
||||
attribute to your articles/pages and set a `DEFAULT_LANG` setting (which is
|
||||
It is possible to translate articles. To do so, you need to add a ``lang`` meta
|
||||
attribute to your articles/pages and set a ``DEFAULT_LANG`` setting (which is
|
||||
English [en] by default). With those settings in place, only articles with the
|
||||
default language will be listed, and each article will be accompanied by a list
|
||||
of available translations for that article.
|
||||
|
|
@ -191,26 +272,20 @@ Pelican is able to provide colorized syntax highlighting for your code blocks.
|
|||
To do so, you have to use the following conventions (you need to put this in
|
||||
your content files).
|
||||
|
||||
For RestructuredText::
|
||||
For RestructuredText, use the code-block directive::
|
||||
|
||||
.. code-block:: identifier
|
||||
|
||||
your code goes here
|
||||
<indented code block goes here>
|
||||
|
||||
For Markdown, format your code blocks thusly::
|
||||
For Markdown, include the language identifier just above the code block,
|
||||
indenting both the identifier and code::
|
||||
|
||||
:::identifier
|
||||
your code goes here
|
||||
:::identifier
|
||||
<code goes here>
|
||||
|
||||
The specified identifier should be one that appears on the
|
||||
`list of available lexers <http://pygments.org/docs/lexers/>`_.
|
||||
|
||||
Auto-reload
|
||||
-----------
|
||||
|
||||
It's possible to tell Pelican to watch for your modifications, instead of
|
||||
manually re-running it every time you want to see your changes. To enable this,
|
||||
run the `pelican` command with the `-r` or `--autoreload` option.
|
||||
The specified identifier (e.g. ``python``, ``ruby``) should be one that
|
||||
appears on the `list of available lexers <http://pygments.org/docs/lexers/>`_.
|
||||
|
||||
Publishing drafts
|
||||
-----------------
|
||||
|
|
@ -234,5 +309,5 @@ Or run a simple web server using Python::
|
|||
|
||||
cd output && python -m SimpleHTTPServer
|
||||
|
||||
(Tip: If using the latter method in conjunction with the auto-reload feature,
|
||||
ensure that `DELETE_OUTPUT_DIRECTORY` is set to `False` in your settings file.)
|
||||
.. _virtualenv: http://www.virtualenv.org/
|
||||
.. _virtualenvwrapper: http://www.doughellmann.com/projects/virtualenvwrapper/
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ BeatifulSoup can be installed like any other Python package::
|
|||
|
||||
$ pip install BeautifulSoup
|
||||
|
||||
For pandoc, install a package for your operating system from the
|
||||
For pandoc, install a package for your operating system from the
|
||||
`pandoc site <http://johnmacfarlane.net/pandoc/installing.html>`_.
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,16 +1,16 @@
|
|||
Pelican
|
||||
#######
|
||||
=======
|
||||
|
||||
Pelican is a simple weblog generator, written in Python.
|
||||
Pelican is a static site generator, written in Python_.
|
||||
|
||||
* Write your weblog entries directly with your editor of choice (vim!) in
|
||||
reStructuredText or Markdown
|
||||
* A simple CLI tool to (re)generate the weblog
|
||||
* Write your weblog entries directly with your editor of choice (vim!)
|
||||
in reStructuredText_ or Markdown_
|
||||
* Includes a simple CLI tool to (re)generate the weblog
|
||||
* Easy to interface with DVCSes and web hooks
|
||||
* Completely static output is easy to host anywhere
|
||||
|
||||
Features
|
||||
========
|
||||
--------
|
||||
|
||||
Pelican currently supports:
|
||||
|
||||
|
|
@ -18,40 +18,38 @@ Pelican currently supports:
|
|||
* Comments, via an external service (Disqus). (Please note that while
|
||||
useful, Disqus is an external service, and thus the comment data will be
|
||||
somewhat outside of your control and potentially subject to data loss.)
|
||||
* Theming support (themes are created using `jinja2 <http://jinja.pocoo.org/>`_)
|
||||
* Theming support (themes are created using Jinja2_ templates)
|
||||
* PDF generation of the articles/pages (optional)
|
||||
* Publication of articles in multiple languages
|
||||
* Atom/RSS feeds
|
||||
* Code syntax highlighting
|
||||
* Compilation of less css (optional)
|
||||
* Compilation of `LESS CSS`_ (optional)
|
||||
* Import from WordPress, Dotclear, or RSS feeds
|
||||
* Integration with external tools: Twitter, Google Analytics, etc. (optional)
|
||||
|
||||
Why the name "Pelican" ?
|
||||
========================
|
||||
Why the name "Pelican"?
|
||||
-----------------------
|
||||
|
||||
Heh, you didn't notice? "Pelican" is an anagram for « Calepin » ;)
|
||||
"Pelican" is an anagram for *calepin*, which means "notebook" in French. ;)
|
||||
|
||||
Source code
|
||||
===========
|
||||
-----------
|
||||
|
||||
You can access the source code via git at http://github.com/ametaireau/pelican/
|
||||
You can access the source code at: https://github.com/getpelican/pelican
|
||||
|
||||
Feedback / Contact us
|
||||
=====================
|
||||
---------------------
|
||||
|
||||
If you want to see new features in Pelican, don't hesitate to tell me, to clone
|
||||
the repository, etc. That's open source, dude!
|
||||
If you want to see new features in Pelican, don't hesitate to offer suggestions,
|
||||
clone the repository, etc. There are many ways to :doc:`contribute<contribute>`.
|
||||
That's open source, dude!
|
||||
|
||||
Contact me at "alexis at notmyidea dot org" for any request/feedback! You can
|
||||
also join the team at `#pelican on irc.freenode.org
|
||||
<irc://irc.freenode.net/pelican>`_
|
||||
(or if you don't have any IRC client, use `the webchat
|
||||
<http://webchat.freenode.net/?channels=pelican&uio=d4>`_)
|
||||
for quick feedback.
|
||||
Send a message to "authors at getpelican dot com" with any requests/feedback! You
|
||||
can also join the team at `#pelican on Freenode`_ (or if you don't have an IRC
|
||||
client handy, use the webchat_ for quick feedback.
|
||||
|
||||
Documentation
|
||||
=============
|
||||
-------------
|
||||
|
||||
A French version of the documentation is available at :doc:`fr/index`.
|
||||
|
||||
|
|
@ -69,3 +67,16 @@ A French version of the documentation is available at :doc:`fr/index`.
|
|||
tips
|
||||
contribute
|
||||
report
|
||||
changelog
|
||||
|
||||
.. Links
|
||||
|
||||
.. _Python: http://www.python.org/
|
||||
.. _reStructuredText: http://docutils.sourceforge.net/rst.html
|
||||
.. _Markdown: http://daringfireball.net/projects/markdown/
|
||||
.. _Jinja2: http://jinja.pocoo.org/
|
||||
.. _`LESS CSS`: http://lesscss.org/
|
||||
.. _`Pelican documentation`: http://docs.getpelican.com/latest/
|
||||
.. _`Pelican's internals`: http://docs.getpelican.com/en/latest/internals.html
|
||||
.. _`#pelican on Freenode`: irc://irc.freenode.net/pelican
|
||||
.. _webchat: http://webchat.freenode.net/?channels=pelican&uio=d4
|
||||
|
|
|
|||
|
|
@ -12,34 +12,34 @@ original author wrote with some software design information.
|
|||
Overall structure
|
||||
=================
|
||||
|
||||
What `pelican` does is take a list of files and process them into some
|
||||
What Pelican does is take a list of files and process them into some
|
||||
sort of output. Usually, the input files are reStructuredText and Markdown
|
||||
files, and the output is a blog, but both input and output can be anything you
|
||||
want.
|
||||
|
||||
The logic is separated into different classes and concepts:
|
||||
|
||||
* `writers` are responsible for writing files: .html files, RSS feeds, and so
|
||||
* **Writers** are responsible for writing files: .html files, RSS feeds, and so
|
||||
on. Since those operations are commonly used, the object is created once and
|
||||
then passed to the generators.
|
||||
|
||||
* `readers` are used to read from various formats (Markdown and
|
||||
* **Readers** are used to read from various formats (Markdown and
|
||||
reStructuredText for now, but the system is extensible). Given a file, they return
|
||||
metadata (author, tags, category, etc.) and content (HTML-formatted).
|
||||
|
||||
* `generators` generate the different outputs. For instance, Pelican comes with
|
||||
`ArticlesGenerator` and `PageGenerator`. Given a configuration, they can do
|
||||
* **Generators** generate the different outputs. For instance, Pelican comes with
|
||||
``ArticlesGenerator`` and ``PageGenerator``. Given a configuration, they can do
|
||||
whatever they want. Most of the time, it's generating files from inputs.
|
||||
|
||||
* `pelican` also uses `templates`, so it's easy to write your own theme. The
|
||||
syntax is `jinja2`, and, trust me, really easy to learn, so don't hesitate
|
||||
to jump in and build your own theme.
|
||||
* Pelican also uses templates, so it's easy to write your own theme. The
|
||||
syntax is `Jinja2 <http://jinja.pocoo.org/>`_ and is very easy to learn, so
|
||||
don't hesitate to jump in and build your own theme.
|
||||
|
||||
How to implement a new reader?
|
||||
==============================
|
||||
|
||||
Is there an awesome markup language you want to add to Pelican?
|
||||
Well, the only thing you have to do is to create a class with a `read`
|
||||
Well, the only thing you have to do is to create a class with a ``read``
|
||||
method that returns HTML content and some metadata.
|
||||
|
||||
Take a look at the Markdown reader::
|
||||
|
|
@ -52,7 +52,7 @@ Take a look at the Markdown reader::
|
|||
text = open(filename)
|
||||
md = Markdown(extensions = ['meta', 'codehilite'])
|
||||
content = md.convert(text)
|
||||
|
||||
|
||||
metadata = {}
|
||||
for name, value in md.Meta.items():
|
||||
if name in _METADATA_FIELDS:
|
||||
|
|
@ -65,8 +65,8 @@ Take a look at the Markdown reader::
|
|||
Simple, isn't it?
|
||||
|
||||
If your new reader requires additional Python dependencies, then you should wrap
|
||||
their `import` statements in a `try...except` block. Then inside the reader's
|
||||
class, set the `enabled` class attribute to mark import success or failure.
|
||||
their ``import`` statements in a ``try...except`` block. Then inside the reader's
|
||||
class, set the ``enabled`` class attribute to mark import success or failure.
|
||||
This makes it possible for users to continue using their favourite markup method
|
||||
without needing to install modules for formats they don't use.
|
||||
|
||||
|
|
@ -76,17 +76,17 @@ How to implement a new generator?
|
|||
Generators have two important methods. You're not forced to create
|
||||
both; only the existing ones will be called.
|
||||
|
||||
* `generate_context`, that is called first, for all the generators.
|
||||
* ``generate_context``, that is called first, for all the generators.
|
||||
Do whatever you have to do, and update the global context if needed. This
|
||||
context is shared between all generators, and will be passed to the
|
||||
templates. For instance, the `PageGenerator` `generate_context` method finds
|
||||
all the pages, transforms them into objects, and populates the context with
|
||||
them. Be careful *not* to output anything using this context at this stage,
|
||||
as it is likely to change by the effect of other generators.
|
||||
templates. For instance, the ``PageGenerator`` ``generate_context`` method
|
||||
finds all the pages, transforms them into objects, and populates the context
|
||||
with them. Be careful *not* to output anything using this context at this
|
||||
stage, as it is likely to change by the effect of other generators.
|
||||
|
||||
* `generate_output` is then called. And guess what is it made for? Oh,
|
||||
* ``generate_output`` is then called. And guess what is it made for? Oh,
|
||||
generating the output. :) It's here that you may want to look at the context
|
||||
and call the methods of the `writer` object that is passed as the first
|
||||
argument of this function. In the `PageGenerator` example, this method will
|
||||
and call the methods of the ``writer`` object that is passed as the first
|
||||
argument of this function. In the ``PageGenerator`` example, this method will
|
||||
look at all the pages recorded in the global context and output a file on
|
||||
the disk (using the writer method `write_file`) for each page encountered.
|
||||
the disk (using the writer method ``write_file``) for each page encountered.
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ In this example, we can see there are three themes available: ``notmyidea``, ``s
|
|||
Note that you can combine the ``--list`` option with the ``-v`` or ``--verbose`` option to get more verbose output, like this:
|
||||
|
||||
.. code-block:: console
|
||||
|
||||
|
||||
$ pelican-themes -v -l
|
||||
/usr/local/lib/python2.6/dist-packages/pelican-2.6.0-py2.6.egg/pelican/themes/notmyidea
|
||||
/usr/local/lib/python2.6/dist-packages/pelican-2.6.0-py2.6.egg/pelican/themes/two-column (symbolic link to `/home/skami/Dev/Python/pelican-themes/two-column')
|
||||
|
|
@ -118,7 +118,7 @@ Creating symbolic links
|
|||
To symbolically link a theme, you can use the ``-s`` or ``--symlink``, which works exactly as the ``--install`` option:
|
||||
|
||||
.. code-block:: console
|
||||
|
||||
|
||||
# pelican-themes --symlink ~/Dev/Python/pelican-themes/two-column
|
||||
|
||||
In this example, the ``two-column`` theme is now symbolically linked to the Pelican themes path, so we can use it, but we can also modify it without having to reinstall it after each modification.
|
||||
|
|
@ -130,11 +130,11 @@ This is useful for theme development:
|
|||
$ sudo pelican-themes -s ~/Dev/Python/pelican-themes/two-column
|
||||
$ pelican ~/Blog/content -o /tmp/out -t two-column
|
||||
$ firefox /tmp/out/index.html
|
||||
$ vim ~/Dev/Pelican/pelican-themes/two-coumn/static/css/main.css
|
||||
$ vim ~/Dev/Pelican/pelican-themes/two-coumn/static/css/main.css
|
||||
$ pelican ~/Blog/content -o /tmp/out -t two-column
|
||||
$ cp /tmp/bg.png ~/Dev/Pelican/pelican-themes/two-coumn/static/img/bg.png
|
||||
$ pelican ~/Blog/content -o /tmp/out -t two-column
|
||||
$ vim ~/Dev/Pelican/pelican-themes/two-coumn/templates/index.html
|
||||
$ vim ~/Dev/Pelican/pelican-themes/two-coumn/templates/index.html
|
||||
$ pelican ~/Blog/content -o /tmp/out -t two-column
|
||||
|
||||
|
||||
|
|
@ -152,7 +152,7 @@ The ``--install``, ``--remove`` and ``--symlink`` option are not mutually exclus
|
|||
--symlink ~/Dev/Python/pelican-themes/two-column \
|
||||
--verbose
|
||||
|
||||
In this example, the theme ``notmyidea-cms`` is replaced by the theme ``notmyidea-cms-fr``
|
||||
In this example, the theme ``notmyidea-cms`` is replaced by the theme ``notmyidea-cms-fr``
|
||||
|
||||
|
||||
|
||||
|
|
@ -162,5 +162,3 @@ See also
|
|||
|
||||
- http://docs.notmyidea.org/alexis/pelican/
|
||||
- ``/usr/share/doc/pelican/`` if you have installed Pelican using the `APT repository <http://skami18.github.com/pelican-packages/>`_
|
||||
|
||||
|
||||
|
|
|
|||
220
docs/plugins.rst
220
docs/plugins.rst
|
|
@ -3,41 +3,41 @@
|
|||
Plugins
|
||||
#######
|
||||
|
||||
Since version 3.0, pelican manages plugins. Plugins are a way to add features
|
||||
to pelican without having to directly hack pelican code.
|
||||
Since version 3.0, Pelican manages plugins. Plugins are a way to add features
|
||||
to Pelican without having to directly hack Pelican code.
|
||||
|
||||
Pelican is shipped with a set of core plugins, but you can easily implement
|
||||
your own (and this page describes how).
|
||||
|
||||
How to use plugins?
|
||||
====================
|
||||
How to use plugins
|
||||
==================
|
||||
|
||||
To load plugins, you have to specify them in your settings file. You have two
|
||||
ways to do so.
|
||||
Either by specifying strings with the path to the callables::
|
||||
|
||||
PLUGINS = ['pelican.plugins.gravatar',]
|
||||
PLUGINS = ['pelican.plugins.gravatar',]
|
||||
|
||||
Or by importing them and adding them to the list::
|
||||
|
||||
from pelican.plugins import gravatar
|
||||
PLUGINS = [gravatar, ]
|
||||
|
||||
If your plugins are not in an importable path, you can specify a `PLUGIN_PATH`
|
||||
If your plugins are not in an importable path, you can specify a ``PLUGIN_PATH``
|
||||
in the settings::
|
||||
|
||||
PLUGIN_PATH = "plugins"
|
||||
PLUGINS = ["list", "of", "plugins"]
|
||||
|
||||
How to create plugins?
|
||||
======================
|
||||
How to create plugins
|
||||
=====================
|
||||
|
||||
Plugins are based on the concept of signals. Pelican sends signals and plugins
|
||||
Plugins are based on the concept of signals. Pelican sends signals, and plugins
|
||||
subscribe to those signals. The list of signals are defined in a following
|
||||
section.
|
||||
|
||||
The only rule to follow for plugins is to define a `register` callable, in
|
||||
which you map the signals to your plugin logic. Let's take a simple exemple::
|
||||
The only rule to follow for plugins is to define a ``register`` callable, in
|
||||
which you map the signals to your plugin logic. Let's take a simple example::
|
||||
|
||||
from pelican import signals
|
||||
|
||||
|
|
@ -48,41 +48,79 @@ which you map the signals to your plugin logic. Let's take a simple exemple::
|
|||
signals.initialized.connect(test)
|
||||
|
||||
|
||||
|
||||
List of signals
|
||||
===============
|
||||
|
||||
Here is the list of currently implemented signals:
|
||||
|
||||
========================= ============================ =========================================
|
||||
Signal Arguments Description
|
||||
========================= ============================ =========================================
|
||||
initialized pelican object
|
||||
article_generate_context article_generator, metadata
|
||||
article_generator_init article_generator invoked in the ArticlesGenerator.__init__
|
||||
========================= ============================ =========================================
|
||||
============================= ============================ ===========================================================================
|
||||
Signal Arguments Description
|
||||
============================= ============================ ===========================================================================
|
||||
initialized pelican object
|
||||
finalized pelican object invoked after all the generators are executed and just before pelican exits
|
||||
usefull for custom post processing actions, such as:
|
||||
- minifying js/css assets.
|
||||
- notify/ping search engines with an updated sitemap.
|
||||
article_generate_context article_generator, metadata
|
||||
article_generator_init article_generator invoked in the ArticlesGenerator.__init__
|
||||
article_generator_finalized article_generator invoked at the end of ArticlesGenerator.generate_context
|
||||
get_generators generators invoked in Pelican.get_generator_classes,
|
||||
can return a Generator, or several
|
||||
generator in a tuple or in a list.
|
||||
pages_generate_context pages_generator, metadata
|
||||
pages_generator_init pages_generator invoked in the PagesGenerator.__init__
|
||||
============================= ============================ ===========================================================================
|
||||
|
||||
The list is currently small, don't hesitate to add signals and make a pull
|
||||
request if you need them!
|
||||
|
||||
.. note::
|
||||
|
||||
The signal ``content_object_init`` can send different type of object as
|
||||
argument. If you want to register only one type of object then you will
|
||||
need to specify the sender when you are connecting to the signal.
|
||||
|
||||
::
|
||||
|
||||
from pelican import signals
|
||||
from pelican import contents
|
||||
|
||||
def test(sender, instance):
|
||||
print "%s : %s content initialized !!" % (sender, instance)
|
||||
|
||||
def register():
|
||||
signals.content_object_init.connect(test, sender=contents.Article)
|
||||
|
||||
|
||||
|
||||
List of plugins
|
||||
===============
|
||||
|
||||
Not all the list are described here, but a few of them have been extracted from
|
||||
pelican core and provided in pelican.plugins. They are described here:
|
||||
The following plugins are currently included with Pelican under ``pelican.plugins``:
|
||||
|
||||
Tag cloud
|
||||
---------
|
||||
* `GitHub activity`_
|
||||
* `Global license`_
|
||||
* `Gravatar`_
|
||||
* `HTML tags for reStructuredText`_
|
||||
* `Related posts`_
|
||||
* `Sitemap`_
|
||||
|
||||
Translation
|
||||
-----------
|
||||
Ideas for plugins that haven't been written yet:
|
||||
|
||||
Github Activity
|
||||
* Tag cloud
|
||||
* Translation
|
||||
|
||||
Plugin descriptions
|
||||
===================
|
||||
|
||||
GitHub activity
|
||||
---------------
|
||||
|
||||
This plugin makes use of the ``feedparser`` library that you'll need to
|
||||
install.
|
||||
|
||||
Set the GITHUB_ACTIVITY_FEED parameter to your github activity feed.
|
||||
Set the ``GITHUB_ACTIVITY_FEED`` parameter to your GitHub activity feed.
|
||||
For example, my setting would look like::
|
||||
|
||||
GITHUB_ACTIVITY_FEED = 'https://github.com/kpanic.atom'
|
||||
|
|
@ -105,4 +143,132 @@ variable, as in the example::
|
|||
|
||||
|
||||
``github_activity`` is a list of lists. The first element is the title
|
||||
and the second element is the raw html from github.
|
||||
and the second element is the raw HTML from GitHub.
|
||||
|
||||
Global license
|
||||
--------------
|
||||
|
||||
This plugin allows you to define a LICENSE setting and adds the contents of that
|
||||
license variable to the article's context, making that variable available to use
|
||||
from within your theme's templates.
|
||||
|
||||
Gravatar
|
||||
--------
|
||||
|
||||
This plugin assigns the ``author_gravatar`` variable to the Gravatar URL and
|
||||
makes the variable available within the article's context. You can add
|
||||
AUTHOR_EMAIL to your settings file to define the default author's email
|
||||
address. Obviously, that email address must be associated with a Gravatar
|
||||
account.
|
||||
|
||||
Alternatively, you can provide an email address from within article metadata::
|
||||
|
||||
:email: john.doe@example.com
|
||||
|
||||
If the email address is defined via at least one of the two methods above,
|
||||
the ``author_gravatar`` variable is added to the article's context.
|
||||
|
||||
HTML tags for reStructuredText
|
||||
------------------------------
|
||||
|
||||
This plugin allows you to use HTML tags from within reST documents. Following
|
||||
is a usage example, which is in this case a contact form::
|
||||
|
||||
.. html::
|
||||
|
||||
<form method="GET" action="mailto:some email">
|
||||
<p>
|
||||
<input type="text" placeholder="Subject" name="subject">
|
||||
<br />
|
||||
<textarea name="body" placeholder="Message">
|
||||
</textarea>
|
||||
<br />
|
||||
<input type="reset"><input type="submit">
|
||||
</p>
|
||||
</form>
|
||||
|
||||
Related posts
|
||||
-------------
|
||||
|
||||
This plugin adds the ``related_posts`` variable to the article's context.
|
||||
To enable, add the following to your settings file::
|
||||
|
||||
from pelican.plugins import related_posts
|
||||
PLUGINS = [related_posts]
|
||||
|
||||
You can then use the ``article.related_posts`` variable in your templates.
|
||||
For example::
|
||||
|
||||
{% if article.related_posts %}
|
||||
<ul>
|
||||
{% for related_post in article.related_posts %}
|
||||
<li>{{ related_post }}</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endif %}
|
||||
|
||||
Sitemap
|
||||
-------
|
||||
|
||||
The sitemap plugin generates plain-text or XML sitemaps. You can use the
|
||||
``SITEMAP`` variable in your settings file to configure the behavior of the
|
||||
plugin.
|
||||
|
||||
The ``SITEMAP`` variable must be a Python dictionary, it can contain three keys:
|
||||
|
||||
- ``format``, which sets the output format of the plugin (``xml`` or ``txt``)
|
||||
|
||||
- ``priorities``, which is a dictionary with three keys:
|
||||
|
||||
- ``articles``, the priority for the URLs of the articles and their
|
||||
translations
|
||||
|
||||
- ``pages``, the priority for the URLs of the static pages
|
||||
|
||||
- ``indexes``, the priority for the URLs of the index pages, such as tags,
|
||||
author pages, categories indexes, archives, etc...
|
||||
|
||||
All the values of this dictionary must be decimal numbers between ``0`` and ``1``.
|
||||
|
||||
- ``changefreqs``, which is a dictionary with three items:
|
||||
|
||||
- ``articles``, the update frequency of the articles
|
||||
|
||||
- ``pages``, the update frequency of the pages
|
||||
|
||||
- ``indexes``, the update frequency of the index pages
|
||||
|
||||
Valid frequency values are ``always``, ``hourly``, ``daily``, ``weekly``, ``monthly``,
|
||||
``yearly`` and ``never``.
|
||||
|
||||
If a key is missing or a value is incorrect, it will be replaced with the
|
||||
default value.
|
||||
|
||||
The sitemap is saved in ``<output_path>/sitemap.<format>``.
|
||||
|
||||
.. note::
|
||||
``priorities`` and ``changefreqs`` are informations for search engines.
|
||||
They are only used in the XML sitemaps.
|
||||
For more information: <http://www.sitemaps.org/protocol.html#xmlTagDefinitions>
|
||||
|
||||
**Example**
|
||||
|
||||
Here is an example configuration (it's also the default settings):
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
PLUGINS=['pelican.plugins.sitemap',]
|
||||
|
||||
SITEMAP = {
|
||||
'format': 'xml',
|
||||
'priorities': {
|
||||
'articles': 0.5,
|
||||
'indexes': 0.5,
|
||||
'pages': 0.5
|
||||
},
|
||||
'changefreqs': {
|
||||
'articles': 'monthly',
|
||||
'indexes': 'daily',
|
||||
'pages': 'monthly'
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,40 +1,40 @@
|
|||
Some history about pelican
|
||||
Some history about Pelican
|
||||
##########################
|
||||
|
||||
.. warning::
|
||||
|
||||
This page comes from a report the original author (Alexis Métaireau) wrote
|
||||
right after writing pelican, in december 2010. The information may not be
|
||||
up to date.
|
||||
right after writing Pelican, in December 2010. The information may not be
|
||||
up-to-date.
|
||||
|
||||
Pelican is a simple static blog generator. It parses markup files
|
||||
(markdown or restructured text for now), and generate a HTML folder
|
||||
(Markdown or reStructuredText for now) and generates an HTML folder
|
||||
with all the files in it.
|
||||
I've chosen to use python to implement pelican because it seemed to
|
||||
I've chosen to use Python to implement Pelican because it seemed to
|
||||
be simple and to fit to my needs. I did not wanted to define a class for
|
||||
each thing, but still wanted to keep my things loosely coupled.
|
||||
It turns out that it was exactly what I wanted. From time to time,
|
||||
thanks to the feedback of some users, it took me a very few time to
|
||||
provide fixes on it. So far, I've re-factored the pelican code by two
|
||||
times, each time took less than 30 minutes.
|
||||
provide fixes on it. So far, I've re-factored the Pelican code by two
|
||||
times; each time took less than 30 minutes.
|
||||
|
||||
Use case
|
||||
========
|
||||
|
||||
I was previously using wordpress, a solution you can host on a web
|
||||
I was previously using WordPress, a solution you can host on a web
|
||||
server to manage your blog. Most of the time, I prefer using markup
|
||||
languages such as Markdown or RestructuredText to type my articles.
|
||||
languages such as Markdown or reStructuredText to type my articles.
|
||||
To do so, I use vim. I think it is important to let the people choose the
|
||||
tool they want to write the articles. In my opinion, a blog manager
|
||||
should just allow you to take any kind of input and transform it to a
|
||||
weblog. That's what pelican does.
|
||||
weblog. That's what Pelican does.
|
||||
You can write your articles using the tool you want, and the markup
|
||||
language you want, and then generate a static HTML weblog
|
||||
language you want, and then generate a static HTML weblog.
|
||||
|
||||
.. image:: _static/overall.png
|
||||
|
||||
To be flexible enough, pelican have a template support, so you can
|
||||
easily write you own themes if you want to.
|
||||
To be flexible enough, Pelican has template support, so you can easily write
|
||||
your own themes if you want to.
|
||||
|
||||
Design process
|
||||
==============
|
||||
|
|
@ -42,19 +42,18 @@ Design process
|
|||
Pelican came from a need I have. I started by creating a single file
|
||||
application, and I have make it grow to support what it does by now.
|
||||
To start, I wrote a piece of documentation about what I wanted to do.
|
||||
Then, I have created the content I wanted to parse (the restructured
|
||||
text files), and started experimenting with the code.
|
||||
Pelican was 200 lines long, and contained almost ten functions and one
|
||||
class when it was first usable.
|
||||
Then, I created the content I wanted to parse (the reStructuredText files)
|
||||
and started experimenting with the code. Pelican was 200 lines long and
|
||||
contained almost ten functions and one class when it was first usable.
|
||||
|
||||
I have been facing different problems all over the time, and wanted to
|
||||
add features to pelican while using it. The first change I have done was
|
||||
I have been facing different problems all over the time and wanted to
|
||||
add features to Pelican while using it. The first change I have done was
|
||||
to add the support of a settings file. It is possible to pass the options to
|
||||
the command line, but can be tedious if there is a lot of them.
|
||||
In the same way, I have added the support of different things over
|
||||
time: atom feeds, multiple themes, multiple markup support, etc.
|
||||
At some point, it appears that the “only one file” mantra was not good
|
||||
enough for pelican, so I decided to rework a bit all that, and split this in
|
||||
time: Atom feeds, multiple themes, multiple markup support, etc.
|
||||
At some point, it appears that the "only one file" mantra was not good
|
||||
enough for Pelican, so I decided to rework a bit all that, and split this in
|
||||
multiple different files.
|
||||
|
||||
I’ve separated the logic in different classes and concepts:
|
||||
|
|
@ -64,59 +63,59 @@ I’ve separated the logic in different classes and concepts:
|
|||
Since those operations are commonly used, the object is created
|
||||
once, and then passed to the generators.
|
||||
|
||||
* *readers* are used to read from various formats (Markdown, and
|
||||
Restructured Text for now, but the system is extensible). Given a
|
||||
file, they return metadata (author, tags, category etc) and
|
||||
content (HTML formated).
|
||||
* *readers* are used to read from various formats (Markdown and
|
||||
reStructuredText for now, but the system is extensible). Given a
|
||||
file, they return metadata (author, tags, category, etc) and
|
||||
content (HTML formatted).
|
||||
|
||||
* *generators* generate the different outputs. For instance, pelican
|
||||
* *generators* generate the different outputs. For instance, Pelican
|
||||
comes with an ArticlesGenerator and PagesGenerator, into
|
||||
others. Given a configuration, they can do whatever you want
|
||||
them to do. Most of the time it’s generating files from inputs
|
||||
them to do. Most of the time it's generating files from inputs
|
||||
(user inputs and files).
|
||||
|
||||
I also deal with contents objects. They can be `Articles`, `Pages`, `Quotes`,
|
||||
or whatever you want. They are defined in the contents.py module,
|
||||
and represent some content to be used by the program.
|
||||
I also deal with contents objects. They can be ``Articles``, ``Pages``,
|
||||
``Quotes``, or whatever you want. They are defined in the ``contents.py``
|
||||
module and represent some content to be used by the program.
|
||||
|
||||
In more details
|
||||
===============
|
||||
In more detail
|
||||
==============
|
||||
|
||||
Here is an overview of the classes involved in pelican.
|
||||
Here is an overview of the classes involved in Pelican.
|
||||
|
||||
.. image:: _static/uml.jpg
|
||||
|
||||
The interface do not really exists, and I have added it only to clarify the
|
||||
whole picture. I do use duck typing, and not interfaces.
|
||||
The interface does not really exist, and I have added it only to clarify the
|
||||
whole picture. I do use duck typing and not interfaces.
|
||||
|
||||
Internally, the following process is followed:
|
||||
|
||||
* First of all, the command line is parsed, and some content from
|
||||
the user are used to initialize the different generator objects.
|
||||
the user is used to initialize the different generator objects.
|
||||
|
||||
* A `context` is created. It contains the settings from the command
|
||||
* A ``context`` is created. It contains the settings from the command
|
||||
line and a settings file if provided.
|
||||
* The `generate_context` method of each generator is called, updating
|
||||
* The ``generate_context`` method of each generator is called, updating
|
||||
the context.
|
||||
|
||||
* The writer is created, and given to the `generate_output` method of
|
||||
* The writer is created and given to the ``generate_output`` method of
|
||||
each generator.
|
||||
|
||||
I make two calls because it is important that when the output is
|
||||
generated by the generators, the context will not change. In other
|
||||
words, the first method `generate_context` should modify the context,
|
||||
whereas the second `generate_output` method should not.
|
||||
words, the first method ``generate_context`` should modify the context,
|
||||
whereas the second ``generate_output`` method should not.
|
||||
|
||||
Then, it is up to the generators to do what the want, in the
|
||||
`generate_context` and `generate_content` method.
|
||||
Taking the `ArticlesGenerator` class will help to understand some others
|
||||
concepts. Here is what happens when calling the `generate_context`
|
||||
``generate_context`` and ``generate_content`` method.
|
||||
Taking the ``ArticlesGenerator`` class will help to understand some others
|
||||
concepts. Here is what happens when calling the ``generate_context``
|
||||
method:
|
||||
|
||||
* Read the folder “path”, looking for restructured text files, load
|
||||
each of them, and construct a content object (`Article`) with it. To do so,
|
||||
use `Reader` objects.
|
||||
* Update the `context` with all those articles.
|
||||
each of them, and construct a content object (``Article``) with it. To do so,
|
||||
use ``Reader`` objects.
|
||||
* Update the ``context`` with all those articles.
|
||||
|
||||
Then, the `generate_content` method uses the `context` and the `writer` to
|
||||
generate the wanted output
|
||||
Then, the ``generate_content`` method uses the ``context`` and the ``writer`` to
|
||||
generate the wanted output.
|
||||
|
|
|
|||
|
|
@ -8,10 +8,16 @@ the command line::
|
|||
|
||||
Settings are configured in the form of a Python module (a file). You can see an
|
||||
example by looking at `/samples/pelican.conf.py
|
||||
<https://github.com/ametaireau/pelican/raw/master/samples/pelican.conf.py>`_
|
||||
<https://github.com/getpelican/pelican/raw/master/samples/pelican.conf.py>`_
|
||||
|
||||
All the setting identifiers must be set in all-caps, otherwise they will not be
|
||||
processed.
|
||||
processed. Setting values that are numbers (5, 20, etc.), booleans (True,
|
||||
False, None, etc.), dictionaries, or tuples should *not* be enclosed in
|
||||
quotation marks. All other values (i.e., strings) *must* be enclosed in
|
||||
quotation marks.
|
||||
|
||||
Unless otherwise specified, settings that refer to paths can be either absolute or relative to the
|
||||
configuration file.
|
||||
|
||||
The settings you define in the configuration file will be passed to the
|
||||
templates, which allows you to use your settings to add site-wide content.
|
||||
|
|
@ -33,12 +39,19 @@ Setting name (default value) What doe
|
|||
`DISPLAY_PAGES_ON_MENU` (``True``) Whether to display pages on the menu of the
|
||||
template. Templates may or not honor this
|
||||
setting.
|
||||
`FALLBACK_ON_FS_DATE` (``True``) If True, Pelican will use the file system
|
||||
`DEFAULT_DATE` (``fs``) The default date you want to use.
|
||||
If 'fs', Pelican will use the file system
|
||||
timestamp information (mtime) if it can't get
|
||||
date information from the metadata.
|
||||
If tuple object, it will instead generate the
|
||||
default datetime object by passing the tuple to
|
||||
the datetime.datetime constructor.
|
||||
`DELETE_OUTPUT_DIRECTORY` (``False``) Delete the content of the output directory before
|
||||
generating new files.
|
||||
`FILES_TO_COPY` (``()``) A list of files to copy from the source (inside the content
|
||||
directory) to the destination (inside the output directory).
|
||||
For example: ``(('extra/robots.txt', 'robots.txt'),)``.
|
||||
`JINJA_EXTENSIONS` (``[]``) A list of any Jinja2 extensions you want to use.
|
||||
`DELETE_OUTPUT_DIRECTORY` (``False``) Delete the output directory as well as
|
||||
the generated files.
|
||||
`LOCALE` (''[#]_) Change the locale. A list of locales can be provided
|
||||
here or a single string representing one locale.
|
||||
When providing a list, all the locales will be tried
|
||||
|
|
@ -51,26 +64,30 @@ Setting name (default value) What doe
|
|||
Python-Markdown documentation for a complete list of
|
||||
supported extensions.
|
||||
`OUTPUT_PATH` (``'output/'``) Where to output the generated files.
|
||||
`PATH` (``None``) Path to look at for input files.
|
||||
`PAGE_DIR` (``'pages'``) Directory to look at for pages.
|
||||
`PATH` (``None``) Path to content directory to be processed by Pelican.
|
||||
`PAGE_DIR` (``'pages'``) Directory to look at for pages, relative to `PATH`.
|
||||
`PAGE_EXCLUDES` (``()``) A list of directories to exclude when looking for pages.
|
||||
`ARTICLE_DIR` (``''``) Directory to look at for articles.
|
||||
`ARTICLE_DIR` (``''``) Directory to look at for articles, relative to `PATH`.
|
||||
`ARTICLE_EXCLUDES`: (``('pages',)``) A list of directories to exclude when looking for articles.
|
||||
`PDF_GENERATOR` (``False``) Set to True if you want to have PDF versions
|
||||
of your documents. You will need to install
|
||||
`rst2pdf`.
|
||||
`RELATIVE_URLS` (``True``) Defines whether Pelican should use relative URLs or
|
||||
not.
|
||||
`OUTPUT_SOURCES` (``False``) Set to True if you want to copy the articles and pages in their
|
||||
original format (e.g. Markdown or ReStructeredText) to the
|
||||
specified OUTPUT_PATH.
|
||||
`OUTPUT_SOURCES_EXTENSION` (``.text``) Controls the extension that will be used by the SourcesGenerator.
|
||||
Defaults to ``.text``. If not a valid string the default value
|
||||
will be used.
|
||||
`RELATIVE_URLS` (``True``) Defines whether Pelican should use document-relative URLs or
|
||||
not. If set to ``False``, Pelican will use the SITEURL
|
||||
setting to construct absolute URLs.
|
||||
`PLUGINS` (``[]``) The list of plugins to load. See :ref:`plugins`.
|
||||
`SITENAME` (``'A Pelican Blog'``) Your site name
|
||||
`SITEURL` Base URL of your website. Not defined by default,
|
||||
which means the base URL is assumed to be "/" with a
|
||||
root-relative URL structure. If `SITEURL` is specified
|
||||
explicitly, there should be no trailing slash at the end,
|
||||
and URLs will be generated with an absolute URL structure
|
||||
(including the domain). If you want to use relative URLs
|
||||
instead of root-relative or absolute URLs, you should
|
||||
instead use the `RELATIVE_URL` setting.
|
||||
so it is best to specify your SITEURL; if you do not, feeds
|
||||
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_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
|
||||
|
|
@ -78,11 +95,10 @@ Setting name (default value) What doe
|
|||
`TIMEZONE` The timezone used in the date information, to
|
||||
generate Atom and RSS feeds. See the "timezone"
|
||||
section below for more info.
|
||||
`TYPOGRIFY` (``False``) If set to true, some
|
||||
additional transformations will be done on the
|
||||
generated HTML, using the `Typogrify
|
||||
`TYPOGRIFY` (``False``) If set to True, several typographical improvements will be
|
||||
incorporated into the generated HTML via the `Typogrify
|
||||
<http://static.mintchaos.com/projects/typogrify/>`_
|
||||
library
|
||||
library, which can be installed via: ``pip install typogrify``
|
||||
`LESS_GENERATOR` (``FALSE``) Set to True or complete path to `lessc` (if not
|
||||
found in system PATH) to enable compiling less
|
||||
css files. Requires installation of `less css`_.
|
||||
|
|
@ -91,12 +107,17 @@ Setting name (default value) What doe
|
|||
index pages for collections of content e.g. tags and
|
||||
category index pages.
|
||||
`PAGINATED_DIRECT_TEMPLATES` (``('index',)``) Provides the direct templates that should be paginated.
|
||||
`SUMMARY_MAX_LENGTH` (``50``) When creating a short summary of an article, this will
|
||||
`SUMMARY_MAX_LENGTH` (``50``) When creating a short summary of an article, this will
|
||||
be the default length in words of the text created.
|
||||
This only applies if your content does not otherwise
|
||||
specify a summary. Setting to None will cause the summary
|
||||
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
|
||||
|
||||
`MARKDOWN_EXTENSIONS` (``['toc',]``) A list of any Markdown extensions you want to use.
|
||||
===================================================================== =====================================================================
|
||||
|
||||
.. [#] Default is the system locale.
|
||||
|
|
@ -107,6 +128,15 @@ Setting name (default value) What doe
|
|||
URL settings
|
||||
------------
|
||||
|
||||
The first thing to understand is that there are currently two supported methods
|
||||
for URL formation: *relative* and *absolute*. Document-relative URLs are useful
|
||||
when testing locally, and absolute URLs are reliable and most useful when
|
||||
publishing. One method of supporting both is to have one Pelican configuration
|
||||
file for local development and another for publishing. To see an example of this
|
||||
type of setup, use the ``pelican-quickstart`` script as described at the top of
|
||||
the :doc:`Getting Started<getting_started>` page, which will produce two separate
|
||||
configuration files for local development and publishing, respectively.
|
||||
|
||||
You can customize the URLs and locations where files will be saved. The URLs and
|
||||
SAVE_AS variables use Python's format strings. These variables allow you to place
|
||||
your articles in a location such as '{slug}/index.html' and link to them as
|
||||
|
|
@ -131,37 +161,37 @@ Also, you can use other file metadata attributes as well:
|
|||
|
||||
Example usage:
|
||||
|
||||
* ARTICLE_URL = 'posts/{date:%Y}/{date:%b}/{date:%d}/{slug}/'
|
||||
* ARTICLE_SAVE_AS = 'posts/{date:%Y}/{date:%b}/{date:%d}/{slug}/index.html'
|
||||
* ARTICLE_URL = ``'posts/{date:%Y}/{date:%b}/{date:%d}/{slug}/'``
|
||||
* ARTICLE_SAVE_AS = ``'posts/{date:%Y}/{date:%b}/{date:%d}/{slug}/index.html'``
|
||||
|
||||
This would save your articles in something like '/posts/2011/Aug/07/sample-post/index.html',
|
||||
and the URL to this would be '/posts/2011/Aug/07/sample-post/'.
|
||||
|
||||
================================================ =====================================================
|
||||
Setting name (default value) what does it do?
|
||||
================================================ =====================================================
|
||||
`ARTICLE_URL` ('{slug}.html') The URL to refer to an ARTICLE.
|
||||
`ARTICLE_SAVE_AS` ('{slug}.html') The place where we will save an article.
|
||||
`ARTICLE_LANG_URL` ('{slug}-{lang}.html') The URL to refer to an ARTICLE which doesn't use the
|
||||
default language.
|
||||
`ARTICLE_LANG_SAVE_AS` ('{slug}-{lang}.html' The place where we will save an article which
|
||||
doesn't use the default language.
|
||||
`PAGE_URL` ('pages/{slug}.html') The URL we will use to link to a page.
|
||||
`PAGE_SAVE_AS` ('pages/{slug}.html') The location we will save the page.
|
||||
`PAGE_LANG_URL` ('pages/{slug}-{lang}.html') The URL we will use to link to a page which doesn't
|
||||
use the default language.
|
||||
`PAGE_LANG_SAVE_AS` ('pages/{slug}-{lang}.html') The location we will save the page which doesn't
|
||||
use the default language.
|
||||
`AUTHOR_URL` ('author/{slug}.html') The URL to use for an author.
|
||||
`AUTHOR_SAVE_AS` ('author/{slug}.html') The location to save an author.
|
||||
`CATEGORY_URL` ('category/{slug}.html') The URL to use for a category.
|
||||
`CATEGORY_SAVE_AS` ('category/{slug}.html') The location to save a category.
|
||||
`TAG_URL` ('tag/{slug}.html') The URL to use for a tag.
|
||||
`TAG_SAVE_AS` ('tag/{slug}.html') The location to save the tag page.
|
||||
`<DIRECT_TEMPLATE_NAME>_SAVE_AS` The location to save content generated from direct
|
||||
templates. Where <DIRECT_TEMPLATE_NAME> is the
|
||||
upper case template name.
|
||||
================================================ =====================================================
|
||||
==================================================== =====================================================
|
||||
Setting name (default value) What does it do?
|
||||
==================================================== =====================================================
|
||||
`ARTICLE_URL` (``'{slug}.html'``) The URL to refer to an ARTICLE.
|
||||
`ARTICLE_SAVE_AS` (``'{slug}.html'``) The place where we will save an article.
|
||||
`ARTICLE_LANG_URL` (``'{slug}-{lang}.html'``) The URL to refer to an ARTICLE which doesn't use the
|
||||
default language.
|
||||
`ARTICLE_LANG_SAVE_AS` (``'{slug}-{lang}.html'``) The place where we will save an article which
|
||||
doesn't use the default language.
|
||||
`PAGE_URL` (``'pages/{slug}.html'``) The URL we will use to link to a page.
|
||||
`PAGE_SAVE_AS` (``'pages/{slug}.html'``) The location we will save the page.
|
||||
`PAGE_LANG_URL` (``'pages/{slug}-{lang}.html'``) The URL we will use to link to a page which doesn't
|
||||
use the default language.
|
||||
`PAGE_LANG_SAVE_AS` (``'pages/{slug}-{lang}.html'``) The location we will save the page which doesn't
|
||||
use the default language.
|
||||
`AUTHOR_URL` (``'author/{name}.html'``) The URL to use for an author.
|
||||
`AUTHOR_SAVE_AS` (``'author/{name}.html'``) The location to save an author.
|
||||
`CATEGORY_URL` (``'category/{name}.html'``) The URL to use for a category.
|
||||
`CATEGORY_SAVE_AS` (``'category/{name}.html'``) The location to save a category.
|
||||
`TAG_URL` (``'tag/{name}.html'``) The URL to use for a tag.
|
||||
`TAG_SAVE_AS` (``'tag/{name}.html'``) The location to save the tag page.
|
||||
`<DIRECT_TEMPLATE_NAME>_SAVE_AS` The location to save content generated from direct
|
||||
templates. Where <DIRECT_TEMPLATE_NAME> is the
|
||||
upper case template name.
|
||||
==================================================== =====================================================
|
||||
|
||||
.. note::
|
||||
|
||||
|
|
@ -184,14 +214,14 @@ Have a look at `the wikipedia page`_ to get a list of valid timezone values.
|
|||
Date format and locale
|
||||
----------------------
|
||||
|
||||
If no DATE_FORMAT is set, fall back to DEFAULT_DATE_FORMAT. If you need to
|
||||
If no DATE_FORMATS is set, fall back to DEFAULT_DATE_FORMAT. If you need to
|
||||
maintain multiple languages with different date formats, you can set this dict
|
||||
using language name (``lang`` in your posts) as key. Regarding available format
|
||||
codes, see `strftime document of python`_ :
|
||||
|
||||
.. parsed-literal::
|
||||
|
||||
DATE_FORMAT = {
|
||||
DATE_FORMATS = {
|
||||
'en': '%a, %d %b %Y',
|
||||
'jp': '%Y-%m-%d(%a)',
|
||||
}
|
||||
|
|
@ -210,13 +240,13 @@ above:
|
|||
|
||||
.. parsed-literal::
|
||||
# On Unix/Linux
|
||||
DATE_FORMAT = {
|
||||
DATE_FORMATS = {
|
||||
'en': ('en_US','%a, %d %b %Y'),
|
||||
'jp': ('ja_JP','%Y-%m-%d(%a)'),
|
||||
}
|
||||
|
||||
# On Windows
|
||||
DATE_FORMAT = {
|
||||
DATE_FORMATS = {
|
||||
'en': ('usa','%a, %d %b %Y'),
|
||||
'jp': ('jpn','%Y-%m-%d(%a)'),
|
||||
}
|
||||
|
|
@ -240,7 +270,7 @@ feeds if you prefer.
|
|||
|
||||
Pelican generates category feeds as well as feeds for all your articles. It does
|
||||
not generate feeds for tags by default, but it is possible to do so using
|
||||
the ``TAG_FEED`` and ``TAG_FEED_RSS`` settings:
|
||||
the ``TAG_FEED_ATOM`` and ``TAG_FEED_RSS`` settings:
|
||||
|
||||
================================================ =====================================================
|
||||
Setting name (default value) What does it do?
|
||||
|
|
@ -251,11 +281,11 @@ Setting name (default value) What does it do?
|
|||
you have already explicitly defined SITEURL (see
|
||||
above) and want to use the same domain for your
|
||||
feeds, you can just set: `FEED_DOMAIN = SITEURL`
|
||||
`FEED` (``'feeds/all.atom.xml'``) Relative URL to output the Atom feed.
|
||||
`FEED_ATOM` (``'feeds/all.atom.xml'``) Relative URL to output the Atom feed.
|
||||
`FEED_RSS` (``None``, i.e. no RSS) Relative URL to output the RSS feed.
|
||||
`CATEGORY_FEED` ('feeds/%s.atom.xml'[2]_) Where to put the category Atom feeds.
|
||||
`CATEGORY_FEED_ATOM` ('feeds/%s.atom.xml'[2]_) Where to put the category Atom feeds.
|
||||
`CATEGORY_FEED_RSS` (``None``, i.e. no RSS) Where to put the category RSS feeds.
|
||||
`TAG_FEED` (``None``, i.e. no tag feed) Relative URL to output the tag Atom feed. It should
|
||||
`TAG_FEED_ATOM` (``None``, i.e. no tag feed) Relative URL to output the tag Atom feed. It should
|
||||
be defined using a "%s" match in the tag name.
|
||||
`TAG_FEED_RSS` (``None``, ie no RSS tag feed) Relative URL to output the tag RSS feed
|
||||
`FEED_MAX_ITEMS` Maximum number of items allowed in a feed. Feed item
|
||||
|
|
@ -263,7 +293,8 @@ Setting name (default value) What does it do?
|
|||
================================================ =====================================================
|
||||
|
||||
If you don't want to generate some of these feeds, set ``None`` to the
|
||||
variables above.
|
||||
variables above. If you don't want to generate any feeds set both ``FEED_ATOM``
|
||||
and ``FEED_RSS`` to none.
|
||||
|
||||
.. [2] %s is the name of the category.
|
||||
|
||||
|
|
@ -274,7 +305,7 @@ If you want to use FeedBurner for your feed, you will likely need to decide
|
|||
upon a unique identifier. For example, if your site were called "Thyme" and
|
||||
hosted on the www.example.com domain, you might use "thymefeeds" as your
|
||||
unique identifier, which we'll use throughout this section for illustrative
|
||||
purposes. In your Pelican settings, set the `FEED` attribute to
|
||||
purposes. In your Pelican settings, set the `FEED_ATOM` attribute to
|
||||
"thymefeeds/main.xml" to create an Atom feed with an original address of
|
||||
`http://www.example.com/thymefeeds/main.xml`. Set the `FEED_DOMAIN` attribute
|
||||
to `http://feeds.feedburner.com`, or `http://feeds.example.com` if you are
|
||||
|
|
@ -299,10 +330,10 @@ You can use the following settings to configure the pagination.
|
|||
================================================ =====================================================
|
||||
Setting name (default value) What does it do?
|
||||
================================================ =====================================================
|
||||
`DEFAULT_ORPHANS` (0) The minimum number of articles allowed on the
|
||||
`DEFAULT_ORPHANS` (``0``) The minimum number of articles allowed on the
|
||||
last page. Use this when you don't want to
|
||||
have a last page with very few articles.
|
||||
`DEFAULT_PAGINATION` (False) The maximum number of articles to include on a
|
||||
`DEFAULT_PAGINATION` (``False``) The maximum number of articles to include on a
|
||||
page, not including orphans. False to disable
|
||||
pagination.
|
||||
================================================ =====================================================
|
||||
|
|
@ -316,9 +347,9 @@ following settings.
|
|||
================================================ =====================================================
|
||||
Setting name (default value) What does it do?
|
||||
================================================ =====================================================
|
||||
`TAG_CLOUD_STEPS` (4) Count of different font sizes in the tag
|
||||
`TAG_CLOUD_STEPS` (``4``) Count of different font sizes in the tag
|
||||
cloud.
|
||||
`TAG_CLOUD_MAX_ITEMS` (100) Maximum number of tags in the cloud.
|
||||
`TAG_CLOUD_MAX_ITEMS` (``100``) Maximum number of tags in the cloud.
|
||||
================================================ =====================================================
|
||||
|
||||
The default theme does not support tag clouds, but it is pretty easy to add::
|
||||
|
|
@ -338,12 +369,13 @@ Translations
|
|||
Pelican offers a way to translate articles. See the Getting Started section for
|
||||
more information.
|
||||
|
||||
================================================ =====================================================
|
||||
Setting name (default value) What does it do?
|
||||
================================================ =====================================================
|
||||
`DEFAULT_LANG` (``'en'``) The default language to use.
|
||||
`TRANSLATION_FEED` ('feeds/all-%s.atom.xml'[3]_) Where to put the feed for translations.
|
||||
================================================ =====================================================
|
||||
===================================================== =====================================================
|
||||
Setting name (default value) What does it do?
|
||||
===================================================== =====================================================
|
||||
`DEFAULT_LANG` (``'en'``) The default language to use.
|
||||
`TRANSLATION_FEED_ATOM` ('feeds/all-%s.atom.xml'[3]_) Where to put the Atom feed for translations.
|
||||
`TRANSLATION_FEED_RSS` (``None``, i.e. no RSS) Where to put the RSS feed for translations.
|
||||
===================================================== =====================================================
|
||||
|
||||
.. [3] %s is the language
|
||||
|
||||
|
|
@ -353,25 +385,25 @@ Ordering content
|
|||
================================================ =====================================================
|
||||
Setting name (default value) What does it do?
|
||||
================================================ =====================================================
|
||||
`REVERSE_ARCHIVE_ORDER` (``False``) Reverse the archives list order. (True: orders by date
|
||||
in descending order, with newer articles first.)
|
||||
`NEWEST_FIRST_ARCHIVES` (``True``) Order archives by newest first by date. (False:
|
||||
orders by date with older articles first.)
|
||||
`REVERSE_CATEGORY_ORDER` (``False``) Reverse the category order. (True: lists by reverse
|
||||
alphabetical order; default lists alphabetically.)
|
||||
================================================ =====================================================
|
||||
|
||||
Theming
|
||||
=======
|
||||
Themes
|
||||
======
|
||||
|
||||
Theming is addressed in a dedicated section (see :ref:`theming-pelican`).
|
||||
However, here are the settings that are related to theming.
|
||||
Creating Pelican themes is addressed in a dedicated section (see :ref:`theming-pelican`).
|
||||
However, here are the settings that are related to themes.
|
||||
|
||||
================================================ =====================================================
|
||||
Setting name (default value) What does it do?
|
||||
================================================ =====================================================
|
||||
`THEME` Theme to use to produce the output. Can be the
|
||||
complete static path to a theme folder, or
|
||||
chosen between the list of default themes (see
|
||||
below)
|
||||
`THEME` Theme to use to produce the output. Can be a relative
|
||||
or absolute path to a theme folder, or the name of a
|
||||
default theme or a theme installed via
|
||||
``pelican-themes`` (see below).
|
||||
`THEME_STATIC_PATHS` (``['static']``) Static theme paths you want to copy. Default
|
||||
value is `static`, but if your theme has
|
||||
other static paths, you can put them here.
|
||||
|
|
@ -379,22 +411,32 @@ Setting name (default value) What does it do?
|
|||
`WEBASSETS` (``False``) Asset management with `webassets` (see below)
|
||||
================================================ =====================================================
|
||||
|
||||
By default, two themes are available. You can specify them using the `-t` option:
|
||||
|
||||
By default, two themes are available. You can specify them using the `THEME` setting or by passing the
|
||||
``-t`` option to the ``pelican`` command:
|
||||
|
||||
* notmyidea
|
||||
* simple (a synonym for "full text" :)
|
||||
|
||||
You can define your own theme too, and specify its placement in the same
|
||||
manner. (Be sure to specify the full absolute path to it.)
|
||||
|
||||
Here is :doc:`a guide on how to create your theme <themes>`
|
||||
|
||||
You can find a list of themes at http://github.com/ametaireau/pelican-themes.
|
||||
* simple (a synonym for "plain text" :)
|
||||
|
||||
There are a number of other themes available at http://github.com/getpelican/pelican-themes.
|
||||
Pelican comes with :doc:`pelican-themes`, a small script for managing themes.
|
||||
|
||||
The `notmyidea` theme can make good use of the following settings. I recommend
|
||||
using them in your themes as well.
|
||||
You can define your own theme, either by starting from scratch or by duplicating
|
||||
and modifying a pre-existing theme. Here is :doc:`a guide on how to create your theme <themes>`.
|
||||
|
||||
Following are example ways to specify your preferred theme::
|
||||
|
||||
# Specify name of a built-in theme
|
||||
THEME = "notmyidea"
|
||||
# Specify name of a theme installed via the pelican-themes tool
|
||||
THEME = "chunk"
|
||||
# Specify a customized theme, via path relative to the settings file
|
||||
THEME = "themes/mycustomtheme"
|
||||
# Specify a customized theme, via absolute path
|
||||
THEME = "~/projects/mysite/themes/mycustomtheme"
|
||||
|
||||
The built-in `notmyidea` theme can make good use of the following settings. Feel
|
||||
free to use them in your themes as well.
|
||||
|
||||
======================= =======================================================
|
||||
Setting name What does it do ?
|
||||
|
|
@ -430,26 +472,27 @@ adding the following to your configuration::
|
|||
Asset management
|
||||
----------------
|
||||
|
||||
The `WEBASSETS` setting allows to use the `webassets`_ module to manage assets
|
||||
(css, js). The module must first be installed::
|
||||
The `WEBASSETS` setting allows you to use the `webassets`_ module to manage
|
||||
assets such as CSS and JS files. The module must first be installed::
|
||||
|
||||
pip install webassets
|
||||
|
||||
`webassets` allows to concatenate your assets and to use almost all of the
|
||||
hype tools of the moment (see the `documentation`_):
|
||||
The `webassets` module allows you to perform a number of useful asset management
|
||||
functions, including:
|
||||
|
||||
* css minifier (`cssmin`, `yuicompressor`, ...)
|
||||
* css compiler (`less`, `sass`, ...)
|
||||
* js minifier (`uglifyjs`, `yuicompressor`, `closure`, ...)
|
||||
* CSS minifier (`cssmin`, `yuicompressor`, ...)
|
||||
* CSS compiler (`less`, `sass`, ...)
|
||||
* JS minifier (`uglifyjs`, `yuicompressor`, `closure`, ...)
|
||||
|
||||
Others filters include gzip compression, integration of images in css with
|
||||
`datauri` and more. Webassets also append a version identifier to your asset
|
||||
url to convince browsers to download new versions of your assets when you use
|
||||
far future expires headers.
|
||||
Others filters include gzip compression, integration of images in CSS via data
|
||||
URIs, and more. `webassets` can also append a version identifier to your asset
|
||||
URL to convince browsers to download new versions of your assets when you use
|
||||
far-future expires headers. Please refer to the `webassets documentation`_ for
|
||||
more information.
|
||||
|
||||
When using it with Pelican, `webassets` is configured to process assets in the
|
||||
``OUTPUT_PATH/theme`` directory. You can use it in your templates with a
|
||||
template tag, for example:
|
||||
When using with Pelican, `webassets` is configured to process assets in the
|
||||
``OUTPUT_PATH/theme`` directory. You can use `webassets` in your templates by
|
||||
including one or more template tags. For example...
|
||||
|
||||
.. code-block:: jinja
|
||||
|
||||
|
|
@ -457,28 +500,43 @@ template tag, for example:
|
|||
<link rel="stylesheet" href="{{ ASSET_URL }}">
|
||||
{% endassets %}
|
||||
|
||||
will produce a minified css file with the version identifier:
|
||||
... will produce a minified css file with a version identifier:
|
||||
|
||||
.. code-block:: html
|
||||
|
||||
<link href="http://{SITEURL}/theme/css/style.min.css?b3a7c807" rel="stylesheet">
|
||||
|
||||
Another example for javascript:
|
||||
These filters can be combined. Here is an example that uses the SASS compiler
|
||||
and minifies the output:
|
||||
|
||||
.. code-block:: jinja
|
||||
|
||||
{% assets filters="sass,cssmin", output="css/style.min.css", "css/style.scss" %}
|
||||
<link rel="stylesheet" href="{{ ASSET_URL }}">
|
||||
{% endassets %}
|
||||
|
||||
Another example for Javascript:
|
||||
|
||||
.. code-block:: jinja
|
||||
|
||||
{% assets filters="uglifyjs,gzip", output="js/packed.js", "js/jquery.js", "js/base.js", "js/widgets.js" %}
|
||||
<script src="{{ ASSETS_URL }}"></script>
|
||||
<script src="{{ ASSET_URL }}"></script>
|
||||
{% endassets %}
|
||||
|
||||
will produce a minified and gzipped js file:
|
||||
The above will produce a minified and gzipped JS file:
|
||||
|
||||
.. code-block:: html
|
||||
|
||||
<script src="http://{SITEURL}/theme/js/packed.js?00703b9d"></script>
|
||||
|
||||
Pelican's debug mode is propagated to `webassets` to disable asset packaging
|
||||
and instead work with the uncompressed assets. However, this also means that
|
||||
the LESS and SASS files are not compiled. This should be fixed in a future
|
||||
version of `webassets` (cf. the related `bug report
|
||||
<https://github.com/getpelican/pelican/issues/481>`_).
|
||||
|
||||
.. _webassets: https://github.com/miracle2k/webassets
|
||||
.. _documentation: http://webassets.readthedocs.org/en/latest/builtin_filters.html
|
||||
.. _webassets documentation: http://webassets.readthedocs.org/en/latest/builtin_filters.html
|
||||
|
||||
Example settings
|
||||
================
|
||||
|
|
|
|||
|
|
@ -3,11 +3,10 @@
|
|||
How to create themes for Pelican
|
||||
################################
|
||||
|
||||
Pelican uses the great `jinja2 <http://jinja.pocoo.org>`_ templating engine to
|
||||
generate its HTML output. The jinja2 syntax is really simple. If you want to
|
||||
create your own theme, feel free to take inspiration from the "simple" theme,
|
||||
which is available `here
|
||||
<https://github.com/ametaireau/pelican/tree/master/pelican/themes/simple/templates>`_
|
||||
Pelican uses the great `Jinja2 <http://jinja.pocoo.org/>`_ templating engine to
|
||||
generate its HTML output. Jinja2 syntax is really simple. If you want to
|
||||
create your own theme, feel free to take inspiration from the `"simple" theme
|
||||
<https://github.com/getpelican/pelican/tree/master/pelican/themes/simple/templates>`_.
|
||||
|
||||
Structure
|
||||
=========
|
||||
|
|
@ -30,13 +29,13 @@ To make your own theme, you must follow the following structure::
|
|||
└── tags.html // must list all the tags. Can be a tag cloud.
|
||||
|
||||
* `static` contains all the static assets, which will be copied to the output
|
||||
`theme/static` folder. I've put the CSS and image folders here, but they are
|
||||
`theme` folder. I've put the CSS and image folders here, but they are
|
||||
just examples. Put what you need here.
|
||||
|
||||
* `templates` contains all the templates that will be used to generate the content.
|
||||
I've just put the mandatory templates here; you can define your own if it helps
|
||||
you keep things organized while creating your theme.
|
||||
|
||||
|
||||
Templates and variables
|
||||
=======================
|
||||
|
||||
|
|
@ -45,7 +44,7 @@ This document describes which templates should exist in a theme, and which
|
|||
variables will be passed to each template at generation time.
|
||||
|
||||
All templates will receive the variables defined in your settings file, if they
|
||||
are in all-caps. You can access them directly.
|
||||
are in all-caps. You can access them directly.
|
||||
|
||||
Common variables
|
||||
----------------
|
||||
|
|
@ -56,14 +55,14 @@ All of these settings will be available to all templates.
|
|||
Variable Description
|
||||
============= ===================================================
|
||||
articles The list of articles, ordered descending by date
|
||||
All the elements are `Article` objects, so you can
|
||||
All the elements are `Article` objects, so you can
|
||||
access their attributes (e.g. title, summary, author
|
||||
etc.)
|
||||
dates The same list of articles, but ordered by date,
|
||||
ascending
|
||||
tags A key-value dict containing the tags (the keys) and
|
||||
the list of respective articles (the values)
|
||||
categories A key-value dict containing the categories (keys)
|
||||
categories A key-value dict containing the categories (keys)
|
||||
and the list of respective articles (values)
|
||||
pages The list of pages
|
||||
============= ===================================================
|
||||
|
|
@ -183,7 +182,7 @@ dates Articles related to this tag, but ordered by date,
|
|||
ascending
|
||||
articles_paginator A paginator object for the list of articles
|
||||
articles_page The current page of articles
|
||||
dates_paginator A paginator object for the list of articles,
|
||||
dates_paginator A paginator object for the list of articles,
|
||||
ordered by date, ascending
|
||||
dates_page The current page of articles, ordered by date,
|
||||
ascending
|
||||
|
|
@ -191,6 +190,23 @@ page_name TAG_URL where everything after `{slug}` is removed
|
|||
-- useful for pagination links
|
||||
=================== ===================================================
|
||||
|
||||
Feeds
|
||||
=====
|
||||
|
||||
The feed variables changed in 3.0. Each variable now explicitly lists ATOM or
|
||||
RSS in the name. ATOM is still the default. Old themes will need to be updated.
|
||||
Here is a complete list of the feed variables::
|
||||
|
||||
FEED_ATOM
|
||||
FEED_RSS
|
||||
CATEGORY_FEED_ATOM
|
||||
CATEGORY_FEED_RSS
|
||||
TAG_FEED_ATOM
|
||||
TAG_FEED_RSS
|
||||
TRANSLATION_FEED_ATOM
|
||||
TRANSLATION_FEED_RSS
|
||||
|
||||
|
||||
Inheritance
|
||||
===========
|
||||
|
||||
|
|
|
|||
|
|
@ -12,16 +12,16 @@ file generator, we can take advantage of this.
|
|||
|
||||
User Pages
|
||||
----------
|
||||
Github allows you to create user pages in the form of ``username.github.com``.
|
||||
Whatever is created in master branch will be published. For this purposes just
|
||||
the output generated by pelican needs to pushed at github.
|
||||
GitHub allows you to create user pages in the form of ``username.github.com``.
|
||||
Whatever is created in the master branch will be published. For this purpose,
|
||||
just the output generated by Pelican needs to pushed to GitHub.
|
||||
|
||||
So given a repository containing your articles, just run pelican over the posts
|
||||
and deploy the master branch at github::
|
||||
So given a repository containing your articles, just run Pelican over the posts
|
||||
and deploy the master branch to GitHub::
|
||||
|
||||
$ pelican -s pelican.conf.py ./path/to/posts -o /path/to/output
|
||||
|
||||
Now add all the files in the output directory generated by pelican::
|
||||
Now add all the files in the output directory generated by Pelican::
|
||||
|
||||
$ git add /path/to/output/*
|
||||
$ git commit -am "Your Message"
|
||||
|
|
@ -31,12 +31,12 @@ Project Pages
|
|||
-------------
|
||||
For creating Project pages, a branch called ``gh-pages`` is used for publishing.
|
||||
The excellent `ghp-import <https://github.com/davisp/ghp-import>`_ makes this
|
||||
really easy. You will have to install it::
|
||||
really easy, which can be installed via::
|
||||
|
||||
$ pip install ghp-import
|
||||
|
||||
Then, given a repository containing your articles, you would simply have
|
||||
to run Pelican and upload the output to GitHub::
|
||||
Then, given a repository containing your articles, you would simply run
|
||||
Pelican and upload the output to GitHub::
|
||||
|
||||
$ pelican -s pelican.conf.py .
|
||||
$ ghp-import output
|
||||
|
|
@ -45,10 +45,8 @@ to run Pelican and upload the output to GitHub::
|
|||
And that's it.
|
||||
|
||||
If you want, you can put that directly into a post-commit hook, so each time you
|
||||
commit, your blog is up to date on GitHub!
|
||||
commit, your blog is up-to-date on GitHub!
|
||||
|
||||
Put the following into `.git/hooks/post-commit`::
|
||||
|
||||
pelican -s pelican.conf.py . && ghp-import output && git push origin
|
||||
gh-pages
|
||||
Put the following into ``.git/hooks/post-commit``::
|
||||
|
||||
pelican -s pelican.conf.py . && ghp-import output && git push origin gh-pages
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue