mirror of
https://github.com/getpelican/pelican.git
synced 2025-10-15 20:28:56 +02:00
Add feeds for each author
This commit is contained in:
parent
260953da02
commit
e6be02264a
7 changed files with 179 additions and 0 deletions
|
|
@ -474,6 +474,8 @@ Setting name (default value) What does it do?
|
||||||
language.
|
language.
|
||||||
`CATEGORY_FEED_ATOM` ('feeds/%s.atom.xml'[2]_) Where to put the category Atom feeds.
|
`CATEGORY_FEED_ATOM` ('feeds/%s.atom.xml'[2]_) Where to put the category Atom feeds.
|
||||||
`CATEGORY_FEED_RSS` (``None``, i.e. no RSS) Where to put the category RSS feeds.
|
`CATEGORY_FEED_RSS` (``None``, i.e. no RSS) Where to put the category RSS feeds.
|
||||||
|
`AUTHOR_FEED_ATOM` ('feeds/%s.atom.xml'[2]_) Where to put the author Atom feeds.
|
||||||
|
`AUTHOR_FEED_RSS` ('feeds/%s.rss.xml'[2]_) Where to put the author RSS feeds.
|
||||||
`TAG_FEED_ATOM` (``None``, i.e. no tag feed) Relative URL to output the tag Atom feed. It should
|
`TAG_FEED_ATOM` (``None``, i.e. no tag feed) Relative URL to output the tag Atom feed. It should
|
||||||
be defined using a "%s" match in the tag name.
|
be defined using a "%s" match in the tag name.
|
||||||
`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
|
||||||
|
|
|
||||||
|
|
@ -239,6 +239,18 @@ class ArticlesGenerator(Generator):
|
||||||
self.settings['CATEGORY_FEED_RSS']
|
self.settings['CATEGORY_FEED_RSS']
|
||||||
% cat.slug, feed_type='rss')
|
% cat.slug, feed_type='rss')
|
||||||
|
|
||||||
|
for auth, arts in self.authors:
|
||||||
|
arts.sort(key=attrgetter('date'), reverse=True)
|
||||||
|
if self.settings.get('AUTHOR_FEED_ATOM'):
|
||||||
|
writer.write_feed(arts, self.context,
|
||||||
|
self.settings['AUTHOR_FEED_ATOM']
|
||||||
|
% auth.slug)
|
||||||
|
|
||||||
|
if self.settings.get('AUTHOR_FEED_RSS'):
|
||||||
|
writer.write_feed(arts, self.context,
|
||||||
|
self.settings['AUTHOR_FEED_RSS']
|
||||||
|
% auth.slug, feed_type='rss')
|
||||||
|
|
||||||
if (self.settings.get('TAG_FEED_ATOM')
|
if (self.settings.get('TAG_FEED_ATOM')
|
||||||
or self.settings.get('TAG_FEED_RSS')):
|
or self.settings.get('TAG_FEED_RSS')):
|
||||||
for tag, arts in self.tags.items():
|
for tag, arts in self.tags.items():
|
||||||
|
|
|
||||||
|
|
@ -41,6 +41,8 @@ DEFAULT_CONFIG = {
|
||||||
'THEME_STATIC_PATHS': ['static', ],
|
'THEME_STATIC_PATHS': ['static', ],
|
||||||
'FEED_ALL_ATOM': os.path.join('feeds', 'all.atom.xml'),
|
'FEED_ALL_ATOM': os.path.join('feeds', 'all.atom.xml'),
|
||||||
'CATEGORY_FEED_ATOM': os.path.join('feeds', '%s.atom.xml'),
|
'CATEGORY_FEED_ATOM': os.path.join('feeds', '%s.atom.xml'),
|
||||||
|
'AUTHOR_FEED_ATOM': os.path.join('feeds', '%s.atom.xml'),
|
||||||
|
'AUTHOR_FEED_RSS': os.path.join('feeds', '%s.rss.xml'),
|
||||||
'TRANSLATION_FEED_ATOM': os.path.join('feeds', 'all-%s.atom.xml'),
|
'TRANSLATION_FEED_ATOM': os.path.join('feeds', 'all-%s.atom.xml'),
|
||||||
'FEED_MAX_ITEMS': '',
|
'FEED_MAX_ITEMS': '',
|
||||||
'SITEURL': '',
|
'SITEURL': '',
|
||||||
|
|
@ -269,6 +271,7 @@ def configure_settings(settings):
|
||||||
'FEED_ATOM', 'FEED_RSS',
|
'FEED_ATOM', 'FEED_RSS',
|
||||||
'FEED_ALL_ATOM', 'FEED_ALL_RSS',
|
'FEED_ALL_ATOM', 'FEED_ALL_RSS',
|
||||||
'CATEGORY_FEED_ATOM', 'CATEGORY_FEED_RSS',
|
'CATEGORY_FEED_ATOM', 'CATEGORY_FEED_RSS',
|
||||||
|
'AUTHOR_FEED_ATOM', 'AUTHOR_FEED_RSS',
|
||||||
'TAG_FEED_ATOM', 'TAG_FEED_RSS',
|
'TAG_FEED_ATOM', 'TAG_FEED_RSS',
|
||||||
'TRANSLATION_FEED_ATOM', 'TRANSLATION_FEED_RSS',
|
'TRANSLATION_FEED_ATOM', 'TRANSLATION_FEED_RSS',
|
||||||
]
|
]
|
||||||
|
|
|
||||||
20
pelican/tests/output/basic/feeds/alexis-metaireau.atom.xml
Normal file
20
pelican/tests/output/basic/feeds/alexis-metaireau.atom.xml
Normal file
|
|
@ -0,0 +1,20 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<feed xmlns="http://www.w3.org/2005/Atom"><title>A Pelican Blog</title><link href="/" rel="alternate"></link><link href="/feeds/alexis-metaireau.atom.xml" rel="self"></link><id>/</id><updated>2013-11-17T23:29:00Z</updated><entry><title>This is a super article !</title><link href="/this-is-a-super-article.html" rel="alternate"></link><updated>2013-11-17T23:29:00Z</updated><author><name>Alexis Métaireau</name></author><id>tag:,2010-12-02:this-is-a-super-article.html</id><summary type="html"><p>Some content here !</p>
|
||||||
|
<div class="section" id="this-is-a-simple-title">
|
||||||
|
<h2>This is a simple title</h2>
|
||||||
|
<p>And here comes the cool <a class="reference external" href="http://books.couchdb.org/relax/design-documents/views">stuff</a>.</p>
|
||||||
|
<img alt="alternate text" src="|filename|/pictures/Sushi.jpg" style="width: 600px; height: 450px;" />
|
||||||
|
<img alt="alternate text" src="|filename|/pictures/Sushi_Macro.jpg" style="width: 600px; height: 450px;" />
|
||||||
|
<pre class="literal-block">
|
||||||
|
&gt;&gt;&gt; from ipdb import set_trace
|
||||||
|
&gt;&gt;&gt; set_trace()
|
||||||
|
</pre>
|
||||||
|
<p>→ And now try with some utf8 hell: ééé</p>
|
||||||
|
</div>
|
||||||
|
</summary><category term="foo"></category><category term="bar"></category><category term="foobar"></category></entry><entry><title>Oh yeah !</title><link href="/oh-yeah.html" rel="alternate"></link><updated>2010-10-20T10:14:00Z</updated><author><name>Alexis Métaireau</name></author><id>tag:,2010-10-20:oh-yeah.html</id><summary type="html"><div class="section" id="why-not">
|
||||||
|
<h2>Why not ?</h2>
|
||||||
|
<p>After all, why not ? It's pretty simple to do it, and it will allow me to write my blogposts in rst !
|
||||||
|
YEAH !</p>
|
||||||
|
<img alt="alternate text" src="|filename|/pictures/Sushi.jpg" style="width: 600px; height: 450px;" />
|
||||||
|
</div>
|
||||||
|
</summary><category term="oh"></category><category term="bar"></category><category term="yeah"></category></entry></feed>
|
||||||
20
pelican/tests/output/basic/feeds/alexis-metaireau.rss.xml
Normal file
20
pelican/tests/output/basic/feeds/alexis-metaireau.rss.xml
Normal file
|
|
@ -0,0 +1,20 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>A Pelican Blog</title><link>/</link><description></description><atom:link href="/feeds/alexis-metaireau.rss.xml" rel="self"></atom:link><lastBuildDate>Sun, 17 Nov 2013 23:29:00 -0000</lastBuildDate><item><title>This is a super article !</title><link>/this-is-a-super-article.html</link><description><p>Some content here !</p>
|
||||||
|
<div class="section" id="this-is-a-simple-title">
|
||||||
|
<h2>This is a simple title</h2>
|
||||||
|
<p>And here comes the cool <a class="reference external" href="http://books.couchdb.org/relax/design-documents/views">stuff</a>.</p>
|
||||||
|
<img alt="alternate text" src="|filename|/pictures/Sushi.jpg" style="width: 600px; height: 450px;" />
|
||||||
|
<img alt="alternate text" src="|filename|/pictures/Sushi_Macro.jpg" style="width: 600px; height: 450px;" />
|
||||||
|
<pre class="literal-block">
|
||||||
|
&gt;&gt;&gt; from ipdb import set_trace
|
||||||
|
&gt;&gt;&gt; set_trace()
|
||||||
|
</pre>
|
||||||
|
<p>→ And now try with some utf8 hell: ééé</p>
|
||||||
|
</div>
|
||||||
|
</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Alexis Métaireau</dc:creator><pubDate>Sun, 17 Nov 2013 23:29:00 -0000</pubDate><guid>tag:,2010-12-02:this-is-a-super-article.html</guid><category>foo</category><category>bar</category><category>foobar</category></item><item><title>Oh yeah !</title><link>/oh-yeah.html</link><description><div class="section" id="why-not">
|
||||||
|
<h2>Why not ?</h2>
|
||||||
|
<p>After all, why not ? It's pretty simple to do it, and it will allow me to write my blogposts in rst !
|
||||||
|
YEAH !</p>
|
||||||
|
<img alt="alternate text" src="|filename|/pictures/Sushi.jpg" style="width: 600px; height: 450px;" />
|
||||||
|
</div>
|
||||||
|
</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Alexis Métaireau</dc:creator><pubDate>Wed, 20 Oct 2010 10:14:00 -0000</pubDate><guid>tag:,2010-10-20:oh-yeah.html</guid><category>oh</category><category>bar</category><category>yeah</category></item></channel></rss>
|
||||||
61
pelican/tests/output/custom/feeds/alexis-metaireau.atom.xml
Normal file
61
pelican/tests/output/custom/feeds/alexis-metaireau.atom.xml
Normal file
File diff suppressed because one or more lines are too long
61
pelican/tests/output/custom/feeds/alexis-metaireau.rss.xml
Normal file
61
pelican/tests/output/custom/feeds/alexis-metaireau.rss.xml
Normal file
File diff suppressed because one or more lines are too long
Loading…
Add table
Add a link
Reference in a new issue