mirror of
https://github.com/getpelican/pelican.git
synced 2025-10-15 20:28:56 +02:00
Test for FEED & FEED_RSS before generation.
Then we bypass all feed generation of both are set to None or throw a warning if SITEURL is unset. Updated all documentation, to make sure the usage and warning is clear.
This commit is contained in:
parent
f4ab1b2cd0
commit
d9817f9a96
4 changed files with 29 additions and 2 deletions
21
docs/faq.rst
21
docs/faq.rst
|
|
@ -59,4 +59,23 @@ want to have it's own template.
|
||||||
:template: template_name
|
:template: template_name
|
||||||
|
|
||||||
Then just make sure to have the template installed in to your theme as
|
Then just make sure to have the template installed in to your theme as
|
||||||
``template_name.html``.
|
``template_name.html``.
|
||||||
|
|
||||||
|
What if I want to disable feed generation?
|
||||||
|
==========================================
|
||||||
|
|
||||||
|
To disable all feed generation set ``FEED`` 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 arom3 feeds require all URLs and links in them to be absolute. In order
|
||||||
|
to properly generate all URLs properly in perlican you will need to set
|
||||||
|
``SITEURL`` to the full path of your blog. By default, when using the ``make html``
|
||||||
|
to test build your site ``SITEURL`` is disabled so you should receive this
|
||||||
|
warning.
|
||||||
|
If configured properly no other make commands should have this message.
|
||||||
|
|
||||||
|
Feeds still are generated when this error comes up, but may not validate.
|
||||||
|
|
|
||||||
|
|
@ -274,7 +274,8 @@ Setting name (default value) What does it do?
|
||||||
================================================ =====================================================
|
================================================ =====================================================
|
||||||
|
|
||||||
If you don't want to generate some of these feeds, set ``None`` to the
|
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``
|
||||||
|
and ``FEED_RSS`` to none.
|
||||||
|
|
||||||
.. [2] %s is the name of the category.
|
.. [2] %s is the name of the category.
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -124,6 +124,12 @@ class ArticlesGenerator(Generator):
|
||||||
|
|
||||||
def generate_feeds(self, writer):
|
def generate_feeds(self, writer):
|
||||||
"""Generate the feeds from the current context, and output files."""
|
"""Generate the feeds from the current context, and output files."""
|
||||||
|
if self.settings.get('FEED') is None and self.settings.get('FEED_RSS') is None:
|
||||||
|
return
|
||||||
|
elif self.settings.get('SITEURL') is '':
|
||||||
|
logger.warning(
|
||||||
|
'Feeds generated without SITEURL set properly may not be vaild'
|
||||||
|
)
|
||||||
|
|
||||||
if self.settings.get('FEED'):
|
if self.settings.get('FEED'):
|
||||||
writer.write_feed(self.articles, self.context,
|
writer.write_feed(self.articles, self.context,
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,7 @@ _DEFAULT_CONFIG = {'PATH': '.',
|
||||||
'CATEGORY_FEED': 'feeds/%s.atom.xml',
|
'CATEGORY_FEED': 'feeds/%s.atom.xml',
|
||||||
'TRANSLATION_FEED': 'feeds/all-%s.atom.xml',
|
'TRANSLATION_FEED': 'feeds/all-%s.atom.xml',
|
||||||
'FEED_MAX_ITEMS': '',
|
'FEED_MAX_ITEMS': '',
|
||||||
|
'SITEURL': '',
|
||||||
'SITENAME': 'A Pelican Blog',
|
'SITENAME': 'A Pelican Blog',
|
||||||
'DISPLAY_PAGES_ON_MENU': True,
|
'DISPLAY_PAGES_ON_MENU': True,
|
||||||
'PDF_GENERATOR': False,
|
'PDF_GENERATOR': False,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue