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
|
|
|
|
2012-08-01 18:20:12 -07:00
|
|
|
What's the best way to communicate a problem, question, or suggestion?
|
|
|
|
|
======================================================================
|
|
|
|
|
|
2014-05-26 12:32:05 +02:00
|
|
|
Please read our :doc:`feedback guidelines <contribute>`.
|
2012-08-01 18:20:12 -07:00
|
|
|
|
|
|
|
|
How can I help?
|
2015-08-16 10:37:43 -07:00
|
|
|
===============
|
2012-08-01 18:20:12 -07:00
|
|
|
|
2022-09-15 16:33:19 +02:00
|
|
|
There are several ways to help out. First, you can communicate any Pelican
|
|
|
|
|
suggestions or problems you might have via `Pelican Discussions
|
|
|
|
|
<https://github.com/getpelican/pelican/discussions>`_. Please first check the
|
|
|
|
|
existing list of discussions and issues (both open and closed) in order to
|
|
|
|
|
avoid submitting topics that have already been covered before.
|
2012-08-01 18:20:12 -07:00
|
|
|
|
2023-06-24 13:29:02 +02:00
|
|
|
If you want to contribute, please fork `the Git repository
|
2012-08-01 18:20:12 -07:00
|
|
|
<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.
|
2012-08-01 18:20:12 -07:00
|
|
|
|
|
|
|
|
You can also contribute by creating themes and improving the documentation.
|
|
|
|
|
|
2015-08-16 09:57:55 -07:00
|
|
|
Is the Pelican settings file mandatory?
|
2015-08-16 10:37:43 -07:00
|
|
|
=======================================
|
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.
|
2012-03-06 06:13:17 -08:00
|
|
|
For basic operations, it's possible to specify options while invoking Pelican
|
2012-07-01 10:52:39 -07:00
|
|
|
via the command line. See ``pelican --help`` for more information.
|
2011-01-19 16:22:15 +01:00
|
|
|
|
2015-08-16 09:57:55 -07:00
|
|
|
Changes to the settings file take no effect
|
2015-08-16 10:37:43 -07:00
|
|
|
===========================================
|
2014-11-03 15:30:45 +01:00
|
|
|
|
2018-11-02 20:53:15 -06:00
|
|
|
When experimenting with different settings (especially the metadata ones)
|
|
|
|
|
caching may interfere and the changes may not be visible. In such cases, ensure
|
|
|
|
|
that caching is disabled via ``LOAD_CONTENT_CACHE = False`` or use the
|
|
|
|
|
``--ignore-cache`` command-line switch.
|
2014-11-03 15:30:45 +01:00
|
|
|
|
2012-03-06 06:13:17 -08:00
|
|
|
I'm creating my own theme. How do I use Pygments for syntax highlighting?
|
|
|
|
|
=========================================================================
|
2011-01-19 16:22:15 +01:00
|
|
|
|
2012-03-06 06:13:17 -08: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``
|
2012-03-06 06:13:17 -08:00
|
|
|
class in your theme's CSS file. To see how various styles can be used to render
|
2013-05-06 07:28:25 -07:00
|
|
|
Django code, for example, use the style selector drop-down at top-right on the
|
2020-04-12 09:38:35 -05:00
|
|
|
`Pygments project demo site <https://pygments.org/demo/>`_.
|
2013-05-06 07:28:25 -07:00
|
|
|
|
|
|
|
|
You can use the following example commands to generate a starting CSS file from
|
|
|
|
|
a Pygments built-in style (in this case, "monokai") and then copy the generated
|
|
|
|
|
CSS file to your new theme::
|
|
|
|
|
|
|
|
|
|
pygmentize -S monokai -f html -a .highlight > pygment.css
|
|
|
|
|
cp pygment.css path/to/theme/static/css/
|
|
|
|
|
|
|
|
|
|
Don't forget to import your ``pygment.css`` file from your main CSS file.
|
2011-01-19 16:22:15 +01:00
|
|
|
|
2012-03-06 06:13:17 -08:00
|
|
|
How do I create my own theme?
|
2015-08-16 10:37:43 -07:00
|
|
|
=============================
|
2011-01-19 16:22:15 +01:00
|
|
|
|
2012-03-06 06:13:17 -08:00
|
|
|
Please refer to :ref:`theming-pelican`.
|
2011-01-19 16:22:15 +01:00
|
|
|
|
2014-05-12 07:48:37 -07:00
|
|
|
I want to use Markdown, but I got an error.
|
2015-08-16 10:37:43 -07:00
|
|
|
===========================================
|
2011-11-27 18:00:29 +01:00
|
|
|
|
2014-05-12 07:48:37 -07:00
|
|
|
If you try to generate Markdown content without first installing the Markdown
|
2023-06-24 13:29:02 +02:00
|
|
|
library, you may see a message that says ``No valid files found in content``.
|
2013-10-19 17:20:13 +02:00
|
|
|
Markdown is not a hard dependency for Pelican, so if you have content in
|
2018-11-02 20:53:15 -06:00
|
|
|
Markdown format, you will need to explicitly install the Markdown library. You
|
|
|
|
|
can do so by typing the following command, prepending ``sudo`` if permissions
|
|
|
|
|
require it::
|
2011-11-27 18:00:29 +01:00
|
|
|
|
2020-08-17 07:04:00 +02:00
|
|
|
python -m pip install markdown
|
2011-11-27 18:00:29 +01:00
|
|
|
|
2013-04-16 10:13:47 -07:00
|
|
|
Can I use arbitrary metadata in my templates?
|
2015-08-16 10:37:43 -07:00
|
|
|
=============================================
|
2012-08-08 10:21:29 -07:00
|
|
|
|
|
|
|
|
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::
|
2012-08-08 10:21:29 -07:00
|
|
|
|
|
|
|
|
Modified: 2012-08-08
|
|
|
|
|
|
2013-05-06 06:51:54 -07:00
|
|
|
For reStructuredText, this metadata should of course be prefixed with a colon::
|
|
|
|
|
|
|
|
|
|
:Modified: 2012-08-08
|
|
|
|
|
|
2013-08-03 22:31:54 -04:00
|
|
|
This metadata can then be accessed in templates such as ``article.html`` via::
|
2012-08-08 10:21:29 -07:00
|
|
|
|
2013-08-03 12:47:44 -04:00
|
|
|
{% if article.modified %}
|
2012-08-21 14:14:10 -07:00
|
|
|
Last modified: {{ article.modified }}
|
2012-08-08 10:21:29 -07:00
|
|
|
{% endif %}
|
|
|
|
|
|
2013-09-23 19:30:51 +02:00
|
|
|
If you want to include metadata in templates outside the article context (e.g.,
|
|
|
|
|
``base.html``), the ``if`` statement should instead be::
|
2013-08-03 12:47:44 -04:00
|
|
|
|
|
|
|
|
{% if article and article.modified %}
|
|
|
|
|
|
2012-08-01 18:20:12 -07:00
|
|
|
How do I assign custom templates on a per-page basis?
|
2012-07-07 12:15:35 -07:00
|
|
|
=====================================================
|
|
|
|
|
|
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::
|
2012-07-07 12:15:35 -07:00
|
|
|
|
|
|
|
|
: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``).
|
2012-07-14 17:05:04 -07:00
|
|
|
|
2013-04-14 09:41:27 -07:00
|
|
|
How can I override the generated URL of a specific page or article?
|
2012-12-07 01:02:44 +01:00
|
|
|
===================================================================
|
|
|
|
|
|
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::
|
2012-12-07 01:02:44 +01:00
|
|
|
|
|
|
|
|
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``
|
2023-06-24 13:29:02 +02:00
|
|
|
and Pelican will use the URL ``override/url/`` to link to this page.
|
2012-12-07 01:02:44 +01:00
|
|
|
|
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
|
2016-12-03 14:53:26 -08:00
|
|
|
URL:
|
2013-04-14 09:41:27 -07:00
|
|
|
save_as: index.html
|
|
|
|
|
|
|
|
|
|
Thank you for visiting. Welcome!
|
|
|
|
|
|
2014-11-03 15:39:56 +01:00
|
|
|
If the original blog index is still wanted, it can then be saved in a
|
2015-02-06 14:30:02 -08:00
|
|
|
different location by setting ``INDEX_SAVE_AS = 'blog_index.html'`` for
|
|
|
|
|
the ``'index'`` direct template.
|
2014-11-03 15:39:56 +01:00
|
|
|
|
2012-07-14 17:05:04 -07:00
|
|
|
What if I want to disable feed generation?
|
|
|
|
|
==========================================
|
|
|
|
|
|
2018-11-02 20:53:15 -06: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::
|
2012-11-12 23:44:12 +01:00
|
|
|
|
|
|
|
|
FEED_ALL_ATOM = None
|
|
|
|
|
CATEGORY_FEED_ATOM = None
|
2013-04-14 09:41:27 -07:00
|
|
|
TRANSLATION_FEED_ATOM = None
|
2014-09-22 16:36:34 +02:00
|
|
|
AUTHOR_FEED_ATOM = None
|
|
|
|
|
AUTHOR_FEED_RSS = None
|
2012-11-12 23:44:12 +01:00
|
|
|
|
2014-05-12 07:48:37 -07:00
|
|
|
The word ``None`` should not be surrounded by quotes. Please note that ``None``
|
2016-12-03 14:53:26 -08:00
|
|
|
and ``''`` are not the same thing.
|
2012-07-14 17:05:04 -07:00
|
|
|
|
2012-08-01 18:20:12 -07:00
|
|
|
I'm getting a warning about feeds generated without SITEURL being set properly
|
2012-07-14 17:05:04 -07:00
|
|
|
==============================================================================
|
|
|
|
|
|
2013-04-14 09:41:27 -07:00
|
|
|
`RSS and Atom feeds require all URL links to be absolute
|
2020-04-12 09:38:35 -05:00
|
|
|
<https://validator.w3.org/feed/docs/rss2.html#comments>`_. In order to properly
|
2018-11-02 20:53:15 -06:00
|
|
|
generate links in Pelican you will need to set ``SITEURL`` to the full path of
|
|
|
|
|
your site.
|
2012-07-14 17:05:04 -07:00
|
|
|
|
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.
|
2012-07-16 13:47:39 -07:00
|
|
|
|
2021-01-06 07:36:21 +01:00
|
|
|
Can I force Atom feeds to show only summaries instead of article content?
|
|
|
|
|
=========================================================================
|
2012-11-12 23:44:12 +01:00
|
|
|
|
2021-01-06 07:36:21 +01:00
|
|
|
Instead of having to open a separate browser window to read articles, the
|
|
|
|
|
overwhelming majority of folks who use feed readers prefer to read content
|
|
|
|
|
within the feed reader itself. Mainly for that reason, Pelican does not support
|
|
|
|
|
restricting Atom feeds to only contain summaries. Unlike Atom feeds, the RSS
|
|
|
|
|
feed specification does not include a separate ``content`` field, so by default
|
|
|
|
|
Pelican publishes RSS feeds that only contain summaries (but can optionally be
|
|
|
|
|
set to instead publish full content RSS feeds). So the default feed generation
|
|
|
|
|
behavior provides users with a choice: subscribe to Atom feeds for full content
|
|
|
|
|
or to RSS feeds for just the summaries.
|
2013-09-09 00:45:45 +05:00
|
|
|
|
|
|
|
|
Is Pelican only suitable for blogs?
|
|
|
|
|
===================================
|
|
|
|
|
|
2018-11-02 20:53:15 -06:00
|
|
|
No. Pelican can be easily configured to create and maintain any type of static
|
|
|
|
|
site. This may require a little customization of your theme and Pelican
|
|
|
|
|
configuration. For example, if you are building a launch site for your product
|
|
|
|
|
and do not need tags on your site, you could remove the relevant HTML code from
|
|
|
|
|
your theme. You can also disable generation of tag-related pages via::
|
2013-09-09 00:45:45 +05:00
|
|
|
|
|
|
|
|
TAGS_SAVE_AS = ''
|
|
|
|
|
TAG_SAVE_AS = ''
|
2014-02-15 21:20:51 +01:00
|
|
|
|
|
|
|
|
Why does Pelican always write all HTML files even with content caching enabled?
|
|
|
|
|
===============================================================================
|
|
|
|
|
|
2018-11-02 20:53:15 -06:00
|
|
|
In order to reliably determine whether the HTML output is different before
|
|
|
|
|
writing it, a large part of the generation environment including the template
|
|
|
|
|
contexts, imported plugins, etc. would have to be saved and compared, at least
|
|
|
|
|
in the form of a hash (which would require special handling of unhashable
|
|
|
|
|
types), because of all the possible combinations of plugins, pagination, etc.
|
|
|
|
|
which may change in many different ways. This would require a lot more
|
|
|
|
|
processing time and memory and storage space. Simply writing the files each
|
|
|
|
|
time is a lot faster and a lot more reliable.
|
|
|
|
|
|
|
|
|
|
However, this means that the modification time of the files changes every time,
|
|
|
|
|
so a ``rsync`` based upload will transfer them even if their content hasn't
|
|
|
|
|
changed. A simple solution is to make ``rsync`` use the ``--checksum`` option,
|
|
|
|
|
which will make it compare the file checksums in a much faster way than Pelican
|
|
|
|
|
would.
|
|
|
|
|
|
|
|
|
|
When only several specific output files are of interest (e.g. when working on
|
2021-02-18 12:30:44 +01:00
|
|
|
some specific page or the theme templates), the ``WRITE_SELECTED`` option may
|
2018-11-02 20:53:15 -06:00
|
|
|
help, see :ref:`writing_only_selected_content`.
|
2014-11-04 17:00:01 +01:00
|
|
|
|
|
|
|
|
How to process only a subset of all articles?
|
|
|
|
|
=============================================
|
|
|
|
|
|
2018-11-02 20:53:15 -06:00
|
|
|
It is often useful to process only e.g. 10 articles for debugging purposes.
|
|
|
|
|
This can be achieved by explicitly specifying only the filenames of those
|
|
|
|
|
articles in ``ARTICLE_PATHS``. A list of such filenames could be found using a
|
|
|
|
|
command similar to ``cd content; find -name '*.md' | head -n 10``.
|
2015-04-20 16:36:18 +02:00
|
|
|
|
2023-06-24 13:29:02 +02:00
|
|
|
My tag cloud is missing/broken since I upgraded Pelican
|
2015-04-20 16:36:18 +02:00
|
|
|
=======================================================
|
|
|
|
|
|
2021-02-18 12:30:44 +01:00
|
|
|
In an ongoing effort to streamline Pelican, tag cloud generation has been
|
|
|
|
|
moved out of Pelican core and into a separate `plugin
|
|
|
|
|
<https://github.com/pelican-plugins/tag-cloud>`_. See the :ref:`plugins`
|
|
|
|
|
documentation for further information about the Pelican plugin system.
|
2015-06-18 23:33:20 +02:00
|
|
|
|
2015-08-16 09:57:55 -07:00
|
|
|
Since I upgraded Pelican my pages are no longer rendered
|
2015-06-18 23:33:20 +02:00
|
|
|
========================================================
|
2015-10-17 16:48:41 +02:00
|
|
|
|
2018-11-02 20:53:15 -06:00
|
|
|
Pages were available to themes as lowercase ``pages`` and uppercase ``PAGES``.
|
|
|
|
|
To bring this inline with the :ref:`templates-variables` section, ``PAGES`` has
|
|
|
|
|
been removed. This is quickly resolved by updating your theme to iterate over
|
|
|
|
|
``pages`` instead of ``PAGES``. Just replace::
|
2015-06-18 23:33:20 +02:00
|
|
|
|
|
|
|
|
{% for pg in PAGES %}
|
|
|
|
|
|
2015-08-16 10:14:49 -07:00
|
|
|
with something like::
|
2015-06-18 23:33:20 +02:00
|
|
|
|
|
|
|
|
{% for pg in pages %}
|
2015-10-17 16:49:11 +02:00
|
|
|
|
|
|
|
|
How can I stop Pelican from trying to parse my static files as content?
|
|
|
|
|
=======================================================================
|
|
|
|
|
|
|
|
|
|
Pelican's article and page generators run before it's static generator. That
|
|
|
|
|
means if you use a setup similar to the default configuration, where a static
|
|
|
|
|
source directory is defined inside a ``*_PATHS`` setting, all files that have a
|
2018-11-02 20:53:15 -06:00
|
|
|
valid content file ending (``.html``, ``.rst``, ``.md``, ...) will be treated
|
|
|
|
|
as articles or pages before they get treated as static files.
|
2015-10-17 16:49:11 +02:00
|
|
|
|
|
|
|
|
To circumvent this issue either use the appropriate ``*_EXCLUDES`` setting or
|
|
|
|
|
disable the offending reader via ``READERS`` if you don't need it.
|
2020-05-17 06:26:30 +02:00
|
|
|
|
|
|
|
|
Why is [arbitrary Markdown syntax] not supported?
|
|
|
|
|
=================================================
|
|
|
|
|
|
|
|
|
|
Pelican does not directly handle Markdown processing and instead delegates that
|
|
|
|
|
task to the Python-Markdown_ project, the core of which purposefully follows
|
|
|
|
|
the original Markdown syntax rules and not the myriad Markdown "flavors" that
|
|
|
|
|
have subsequently propagated. That said, Python-Markdown_ is quite modular, and
|
|
|
|
|
the syntax you are looking for may be provided by one of the many available
|
|
|
|
|
`Markdown Extensions`_. Alternatively, some folks have created Pelican plugins
|
|
|
|
|
that support Markdown variants, so that may be your best choice if there is a
|
|
|
|
|
particular variant you want to use when writing your content.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.. _Python-Markdown: https://github.com/Python-Markdown/markdown
|
|
|
|
|
.. _Markdown Extensions: https://python-markdown.github.io/extensions/
|