mirror of
https://github.com/getpelican/pelican.git
synced 2025-10-15 20:28:56 +02:00
Merge pull request #290 from justinmayer/feeddomain
Feed link inside feed should use FEED_DOMAIN
This commit is contained in:
commit
0993458a57
4 changed files with 23 additions and 27 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 %}
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ class Writer(object):
|
|||
feed_class = Rss201rev2Feed if feed_type == 'rss' else Atom1Feed
|
||||
feed = feed_class(
|
||||
title=context['SITENAME'],
|
||||
link=self.site_url,
|
||||
link=(self.site_url + '/'),
|
||||
feed_url=self.feed_url,
|
||||
description=context.get('SITESUBTITLE', ''))
|
||||
return feed
|
||||
|
|
@ -36,8 +36,9 @@ class Writer(object):
|
|||
|
||||
feed.add_item(
|
||||
title=item.title,
|
||||
link='%s/%s' % (self.site_url, item.url),
|
||||
unique_id='%s/%s' % (self.site_url, item.url),
|
||||
link='%s%s' % (self.site_url, item.url),
|
||||
unique_id='tag:%s,%s:%s' % (self.site_url.replace('http://', ''),
|
||||
item.date.date(), item.url),
|
||||
description=item.content,
|
||||
categories=item.tags if hasattr(item, 'tags') else None,
|
||||
author_name=getattr(item, 'author', 'John Doe'),
|
||||
|
|
@ -59,7 +60,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