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
|
`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 %}
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ class Writer(object):
|
||||||
feed_class = Rss201rev2Feed if feed_type == 'rss' else Atom1Feed
|
feed_class = Rss201rev2Feed if feed_type == 'rss' else Atom1Feed
|
||||||
feed = feed_class(
|
feed = feed_class(
|
||||||
title=context['SITENAME'],
|
title=context['SITENAME'],
|
||||||
link=self.site_url,
|
link=(self.site_url + '/'),
|
||||||
feed_url=self.feed_url,
|
feed_url=self.feed_url,
|
||||||
description=context.get('SITESUBTITLE', ''))
|
description=context.get('SITESUBTITLE', ''))
|
||||||
return feed
|
return feed
|
||||||
|
|
@ -36,8 +36,9 @@ class Writer(object):
|
||||||
|
|
||||||
feed.add_item(
|
feed.add_item(
|
||||||
title=item.title,
|
title=item.title,
|
||||||
link='%s/%s' % (self.site_url, item.url),
|
link='%s%s' % (self.site_url, item.url),
|
||||||
unique_id='%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,
|
description=item.content,
|
||||||
categories=item.tags if hasattr(item, 'tags') else None,
|
categories=item.tags if hasattr(item, 'tags') else None,
|
||||||
author_name=getattr(item, 'author', 'John Doe'),
|
author_name=getattr(item, 'author', 'John Doe'),
|
||||||
|
|
@ -59,7 +60,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