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
|
`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
|
`FEED_MAX_ITEMS` Maximum number of items allowed in a feed. Feed item
|
||||||
quantity is unrestricted by default.
|
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
|
If you don't want to generate some of these feeds, set ``None`` to the
|
||||||
|
|
@ -250,21 +245,21 @@ variables above.
|
||||||
FeedBurner
|
FeedBurner
|
||||||
----------
|
----------
|
||||||
|
|
||||||
If you want to use FeedBurner for your primary Atom feed, there are two
|
If you want to use FeedBurner for your feed, you will likely need to decide
|
||||||
primary fields to configure in the `FeedBurner
|
upon a unique identifier. For example, if your site were called "Thyme" and
|
||||||
<http://feedburner.google.com>`_ interface: "Original Feed" and "Feed Address".
|
hosted on the www.example.com domain, you might use "thymefeeds" as your
|
||||||
If using the default Pelican `FEED` attribute and assuming your feeds
|
unique identifier, which we'll use throughout this section for illustrative
|
||||||
are served from the `www.example.com` domain, you would enter
|
purposes. In your Pelican settings, set the `FEED` attribute to
|
||||||
`http://www.example.com/feeds/all.atom.xml` in the "Original Feed" field in
|
"thymefeeds/main.xml" to create an Atom feed with an original address of
|
||||||
FeedBurner.
|
`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
|
There are two fields to configure in the `FeedBurner
|
||||||
whatever suffix you prefer. In your Pelican settings, assign this suffix to
|
<http://feedburner.google.com>`_ interface: "Original Feed" and "Feed
|
||||||
the `FEED_MAIN_URL` setting. So if your FeedBurner feed address is set to
|
Address". In this example, the "Original Feed" would be
|
||||||
`http://feeds.feedburner.com/myblogfeed`, in your Pelican settings you would
|
`http://www.example.com/thymefeeds/main.xml` and the "Feed Address" suffix
|
||||||
set: `FEED_MAIN_URL = "myblogfeed"`. Then set the `FEED_DOMAIN` setting to
|
would be `thymefeeds/main.xml`.
|
||||||
`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).
|
|
||||||
|
|
||||||
Pagination
|
Pagination
|
||||||
==========
|
==========
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,6 @@ _DEFAULT_CONFIG = {'PATH': '.',
|
||||||
'STATIC_PATHS': ['images', ],
|
'STATIC_PATHS': ['images', ],
|
||||||
'THEME_STATIC_PATHS': ['static', ],
|
'THEME_STATIC_PATHS': ['static', ],
|
||||||
'FEED': 'feeds/all.atom.xml',
|
'FEED': 'feeds/all.atom.xml',
|
||||||
'FEED_MAIN_URL': 'feeds/all.atom.xml',
|
|
||||||
'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': '',
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
<title>{% block title %}{{ SITENAME }}{%endblock%}</title>
|
<title>{% block title %}{{ SITENAME }}{%endblock%}</title>
|
||||||
<meta charset="utf-8" />
|
<meta charset="utf-8" />
|
||||||
<link rel="stylesheet" href="{{ SITEURL }}/theme/css/{{ CSS_FILE }}" type="text/css" />
|
<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 %}
|
{% if FEED_RSS %}
|
||||||
<link href="{{ FEED_DOMAIN }}/{{ FEED_RSS }}" type="application/rss+xml" rel="alternate" title="{{ SITENAME }} RSS Feed" />
|
<link href="{{ FEED_DOMAIN }}/{{ FEED_RSS }}" type="application/rss+xml" rel="alternate" title="{{ SITENAME }} RSS Feed" />
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
@ -56,7 +56,7 @@
|
||||||
<div class="social">
|
<div class="social">
|
||||||
<h2>social</h2>
|
<h2>social</h2>
|
||||||
<ul>
|
<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 %}
|
{% if FEED_RSS %}
|
||||||
<li><a href="{{ FEED_DOMAIN }}/{{ FEED_RSS }}" type="application/rss+xml" rel="alternate">rss feed</a></li>
|
<li><a href="{{ FEED_DOMAIN }}/{{ FEED_RSS }}" type="application/rss+xml" rel="alternate">rss feed</a></li>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
|
||||||
|
|
@ -59,7 +59,8 @@ class Writer(object):
|
||||||
locale.setlocale(locale.LC_ALL, 'C')
|
locale.setlocale(locale.LC_ALL, 'C')
|
||||||
try:
|
try:
|
||||||
self.site_url = context.get('SITEURL', get_relative_path(filename))
|
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)
|
feed = self._create_new_feed(feed_type, context)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue