Skip to content
This repository was archived by the owner on Jun 6, 2021. It is now read-only.

Commit 8cf2832

Browse files
committed
feeds: generate proper links to articles
1 parent f155f4c commit 8cf2832

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

cms7/modules/feed.py

+6-5
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,17 @@
1212

1313

1414
class Feed:
15-
def __init__(self, parent, ftype):
15+
def __init__(self, parent, name, ftype):
1616
self.parent = parent
17+
self.name = name
1718
self.ftype = ftype
1819

1920
def render(self, gs):
2021
blog = self.parent.blog.get_api(gs)
21-
feed = self.ftype(self.parent.cfg['title'], self.parent.cfg['link'], self.parent.cfg['description'])
22+
feed = self.ftype(self.parent.cfg['title'], gs.url_for(self.name, absolute=True), self.parent.cfg['description'])
2223

2324
for a in blog.articles[-15:]:
24-
feed.add_item(a.title, 'TODO', a.source.text, author_name=a.author)
25+
feed.add_item(a.title, gs.url_for(a.name, absolute=True), a.source.text, author_name=a.author)
2526

2627
return feed.writeString('utf-8') + '\n'
2728

@@ -44,6 +45,6 @@ def __init__(self, *a, module, output, **kw):
4445

4546
def run(self, gen):
4647
gen.add_render(self.output / 'atom', self.output / 'atom.xml',
47-
Feed(self, Atom1Feed).render)
48+
Feed(self, self.output / 'atom', Atom1Feed).render)
4849
gen.add_render(self.output / 'rss', self.output / 'rss.xml',
49-
Feed(self, Rss201rev2Feed).render)
50+
Feed(self, self.output / 'rss', Rss201rev2Feed).render)

0 commit comments

Comments
 (0)