1
0
Fork 0
forked from github/pelican
pelican-theme/docs/faq.rst

180 lines
6.9 KiB
ReStructuredText
Raw Normal View History

2011-01-19 16:22:15 +01:00
Frequently Asked Questions (FAQ)
################################
2012-12-03 16:31:55 -08:00
Here are some frequently asked questions about Pelican.
2011-01-19 16:22:15 +01:00
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
2013-04-16 10:13:47 -07:00
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 wait long enough (it may take a few hours).
2013-04-16 10:13:47 -07:00
If you're 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?
================
2013-04-14 09:41:27 -07:00
There are several ways to help out. First, you can report any Pelican
2012-12-03 16:31:55 -08:00
suggestions or problems you might have via IRC or the `issue tracker
2013-04-14 09:41:27 -07:00
<https://github.com/getpelican/pelican/issues>`_. If submitting an issue
report, please check the existing issue list first in order to avoid submitting
a duplicate issue.
If you want to contribute, please fork `the git repository
<https://github.com/getpelican/pelican/>`_, create a new feature branch, make
2013-04-16 10:13:47 -07:00
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?
=============================================
2011-01-19 16:22:15 +01:00
2013-04-14 09:41:27 -07:00
Configuration files are optional and 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.
2011-01-19 16:22:15 +01:00
I'm creating my own theme. How do I use Pygments for syntax highlighting?
=========================================================================
2011-01-19 16:22:15 +01:00
Pygments adds some classes to the generated content. These classes are used by
themes to style code syntax highlighting via CSS. Specifically, you can
2013-04-02 18:09:21 -04:00
customize the appearance of your syntax highlighting via the ``.highlight 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/>`_.
2011-01-19 16:22:15 +01:00
How do I create my own theme?
2011-01-19 16:22:15 +01:00
==============================
Please refer to :ref:`theming-pelican`.
2011-01-19 16:22:15 +01:00
I want to use Markdown, but I got an error.
===========================================
Markdown is not a hard dependency for Pelican, so you will need to explicitly
2013-04-14 09:41:27 -07:00
install it. You can do so by typing the following command, prepending ``sudo``
if permissions require it::
2013-04-14 09:41:27 -07:00
pip install markdown
2013-04-14 09:41:27 -07:00
If you don't have ``pip`` installed, consider installing it via::
2013-04-14 09:41:27 -07:00
easy_install pip
2013-04-16 10:13:47 -07:00
Can I use arbitrary metadata in my templates?
==============================================
Yes. For example, to include a modified date in a Markdown post, one could
2012-08-08 10:27:45 -07:00
include the following at the top of the article::
Modified: 2012-08-08
For reStructuredText, this metadata should of course be prefixed with a colon::
:Modified: 2012-08-08
This metadata can then be accessed in the template::
{% if article.modified %}
2012-08-21 14:14:10 -07:00
Last modified: {{ article.modified }}
{% endif %}
How do I assign custom templates on a per-page basis?
=====================================================
2013-04-16 10:13:47 -07:00
It's as simple as adding an extra line of metadata to any page or article that
2013-04-14 09:41:27 -07:00
you want to have its own template. For example, this is how it would be handled
for content in reST format::
:template: template_name
2013-04-14 09:41:27 -07:00
For content in Markdown format::
Template: template_name
2012-12-03 16:31:55 -08:00
Then just make sure your theme contains the relevant template file (e.g.
``template_name.html``).
2013-04-14 09:41:27 -07:00
How can I override the generated URL of a specific page or article?
===================================================================
2013-04-16 10:13:47 -07:00
Include ``url`` and ``save_as`` metadata in any pages or articles that you want
2013-04-14 09:41:27 -07:00
to override the generated URL. Here is an example page in reST format::
Override url/save_as page
#########################
:url: override/url/
:save_as: override/url/index.html
2013-04-16 10:13:47 -07:00
With this metadata, the page will be written to ``override/url/index.html``
and Pelican will use url ``override/url/`` to link to this page.
2013-04-14 09:41:27 -07:00
How can I use a static page as my home page?
============================================
The override feature mentioned above can be used to specify a static page as
your home page. The following Markdown example could be stored in
``content/pages/home.md``::
Title: Welcome to My Site
URL:
2013-04-14 09:41:27 -07:00
save_as: index.html
Thank you for visiting. Welcome!
What if I want to disable feed generation?
==========================================
2013-04-14 09:41:27 -07:00
To disable feed generation, all feed settings should be set to ``None``.
All but three feed settings already default to ``None``, so if you want to
disable all feed generation, you only need to specify the following settings::
FEED_ALL_ATOM = None
CATEGORY_FEED_ATOM = None
2013-04-14 09:41:27 -07:00
TRANSLATION_FEED_ATOM = None
Please note that ``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
==============================================================================
2013-04-14 09:41:27 -07:00
`RSS and Atom feeds require all URL links to be absolute
<http://validator.w3.org/feed/docs/rss2.html#comments>`_.
2013-04-14 09:41:27 -07:00
In order to properly generate links in Pelican you will need to set ``SITEURL``
to the full path of your site.
2013-04-14 09:41:27 -07:00
Feeds are still generated when this warning is displayed, but links within may
be malformed and thus the feed may not validate.
My feeds are broken since I upgraded to Pelican 3.x
===================================================
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
2013-04-14 09:41:27 -07:00
setting names). Here is an exact list of the renamed settings::
FEED -> FEED_ATOM
TAG_FEED -> TAG_FEED_ATOM
CATEGORY_FEED -> CATEGORY_FEED_ATOM
Starting in 3.1, the new feed ``FEED_ALL_ATOM`` has been introduced: this
2012-12-03 16:31:55 -08:00
feed will aggregate all posts regardless of their language. This setting
generates ``'feeds/all.atom.xml'`` by default and ``FEED_ATOM`` now defaults to
``None``. The following feed setting has also been renamed::
TRANSLATION_FEED -> TRANSLATION_FEED_ATOM
2012-12-03 16:31:55 -08:00
Older themes that referenced the old setting names may not link properly.
In order to rectify this, please update your theme for compatibility by changing
the relevant values in your template files. For an example of complete feed
headers and usage please check out the ``simple`` theme.