mirror of
https://github.com/getpelican/pelican.git
synced 2025-10-15 20:28:56 +02:00
Feed link inside feed should use FEED_DOMAIN
The initial work on enabling feeds to be served from a different domain than the site domain focused on the feed link displayed inside the base template. But there is also a feed link inside the generated feed itself, which this commit updates to use the FEED_DOMAIN value (if defined). Also, it turns out that the FEED_MAIN_URL setting is not necessary; the existing FEED and FEED_RSS functionality is simpler and can address the targeted use case just as easily. That attribute has been removed from the settings and template, along with corresponding changes to the docs. Refs #177.
This commit is contained in:
parent
c71ad2babc
commit
34310a61f5
4 changed files with 19 additions and 24 deletions
|
|
@ -235,11 +235,6 @@ Setting name (default value) What does it do?
|
|||
`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
|
||||
quantity is unrestricted by default.
|
||||
`FEED_MAIN_URL` (``'feeds/all.atom.xml'``) URL appended to domain for the main Atom feed and
|
||||
used to populate its `<link>` in the base template.
|
||||
Useful when you want the feed link to differ from the
|
||||
filesystem path, such as when using web server
|
||||
aliases/rewrites or FeedBurner (see below).
|
||||
================================================ =====================================================
|
||||
|
||||
If you don't want to generate some of these feeds, set ``None`` to the
|
||||
|
|
@ -250,21 +245,21 @@ variables above.
|
|||
FeedBurner
|
||||
----------
|
||||
|
||||
If you want to use FeedBurner for your primary Atom feed, there are two
|
||||
primary fields to configure in the `FeedBurner
|
||||
<http://feedburner.google.com>`_ interface: "Original Feed" and "Feed Address".
|
||||
If using the default Pelican `FEED` attribute and assuming your feeds
|
||||
are served from the `www.example.com` domain, you would enter
|
||||
`http://www.example.com/feeds/all.atom.xml` in the "Original Feed" field in
|
||||
FeedBurner.
|
||||
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
|
||||
"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
|
||||
using a CNAME on your own domain (i.e., FeedBurner's "MyBrand" feature).
|
||||
|
||||
For the "Feed Address" field in the FeedBurner interface, you may choose
|
||||
whatever suffix you prefer. In your Pelican settings, assign this suffix to
|
||||
the `FEED_MAIN_URL` setting. So if your FeedBurner feed address is set to
|
||||
`http://feeds.feedburner.com/myblogfeed`, in your Pelican settings you would
|
||||
set: `FEED_MAIN_URL = "myblogfeed"`. Then set the `FEED_DOMAIN` setting to
|
||||
`http://feeds.feedburner.com`, or `http://feeds.example.com` if you are using
|
||||
a CNAME on your own domain (i.e., FeedBurner's "MyBrand" feature).
|
||||
There are two fields to configure in the `FeedBurner
|
||||
<http://feedburner.google.com>`_ interface: "Original Feed" and "Feed
|
||||
Address". In this example, the "Original Feed" would be
|
||||
`http://www.example.com/thymefeeds/main.xml` and the "Feed Address" suffix
|
||||
would be `thymefeeds/main.xml`.
|
||||
|
||||
Pagination
|
||||
==========
|
||||
|
|
|
|||
|
|
@ -22,7 +22,6 @@ _DEFAULT_CONFIG = {'PATH': '.',
|
|||
'STATIC_PATHS': ['images', ],
|
||||
'THEME_STATIC_PATHS': ['static', ],
|
||||
'FEED': 'feeds/all.atom.xml',
|
||||
'FEED_MAIN_URL': 'feeds/all.atom.xml',
|
||||
'CATEGORY_FEED': 'feeds/%s.atom.xml',
|
||||
'TRANSLATION_FEED': 'feeds/all-%s.atom.xml',
|
||||
'FEED_MAX_ITEMS': '',
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
<title>{% block title %}{{ SITENAME }}{%endblock%}</title>
|
||||
<meta charset="utf-8" />
|
||||
<link rel="stylesheet" href="{{ SITEURL }}/theme/css/{{ CSS_FILE }}" type="text/css" />
|
||||
<link href="{{ FEED_DOMAIN }}/{{ FEED_MAIN_URL }}" type="application/atom+xml" rel="alternate" title="{{ SITENAME }} Atom Feed" />
|
||||
<link href="{{ FEED_DOMAIN }}/{{ FEED }}" type="application/atom+xml" rel="alternate" title="{{ SITENAME }} Atom Feed" />
|
||||
{% if FEED_RSS %}
|
||||
<link href="{{ FEED_DOMAIN }}/{{ FEED_RSS }}" type="application/rss+xml" rel="alternate" title="{{ SITENAME }} RSS Feed" />
|
||||
{% endif %}
|
||||
|
|
@ -56,7 +56,7 @@
|
|||
<div class="social">
|
||||
<h2>social</h2>
|
||||
<ul>
|
||||
<li><a href="{{ FEED_DOMAIN }}/{{ FEED_MAIN_URL }}" type="application/atom+xml" rel="alternate">atom feed</a></li>
|
||||
<li><a href="{{ FEED_DOMAIN }}/{{ FEED }}" type="application/atom+xml" rel="alternate">atom feed</a></li>
|
||||
{% if FEED_RSS %}
|
||||
<li><a href="{{ FEED_DOMAIN }}/{{ FEED_RSS }}" type="application/rss+xml" rel="alternate">rss feed</a></li>
|
||||
{% endif %}
|
||||
|
|
|
|||
|
|
@ -59,7 +59,8 @@ class Writer(object):
|
|||
locale.setlocale(locale.LC_ALL, 'C')
|
||||
try:
|
||||
self.site_url = context.get('SITEURL', get_relative_path(filename))
|
||||
self.feed_url = '%s/%s' % (self.site_url, filename)
|
||||
self.feed_domain = context.get('FEED_DOMAIN')
|
||||
self.feed_url = '%s/%s' % (self.feed_domain, filename)
|
||||
|
||||
feed = self._create_new_feed(feed_type, context)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue