[FIX] website_blog: correct RSS feed
Order blogs by post_date write_date is changed each time a new visitor reach the page (number of visit) Fixes tw:legalsylvain/status/951559451399671808 Closes #22198
This commit is contained in:
@@ -177,7 +177,9 @@ class WebsiteBlog(http.Controller):
|
||||
v = {}
|
||||
v['blog'] = blog
|
||||
v['base_url'] = request.env['ir.config_parameter'].get_param('web.base.url')
|
||||
v['posts'] = request.env['blog.post'].search([('blog_id','=', blog.id)], limit=min(int(limit), 50))
|
||||
v['posts'] = request.env['blog.post'].search([('blog_id','=', blog.id)],
|
||||
limit=min(int(limit), 50),
|
||||
order="post_date DESC")
|
||||
v['html2plaintext'] = html2plaintext
|
||||
r = request.render("website_blog.blog_feed", v, headers=[('Content-Type', 'application/atom+xml')])
|
||||
return r
|
||||
|
||||
@@ -552,14 +552,14 @@
|
||||
<title t-esc="blog.name"/>
|
||||
<link t-att-href="'%s/blog/%s' % (base_url ,blog.id)"/>
|
||||
<id t-esc="'%s/blog/%s' % (base_url, blog.id)"/>
|
||||
<updated t-esc="(posts[0] if posts else blog).write_date.replace(' ', 'T') + 'Z'"/>
|
||||
<updated t-esc="(posts[0] if posts else blog).post_date.replace(' ', 'T') + 'Z'"/>
|
||||
<entry t-foreach="posts" t-as="post">
|
||||
<title t-esc="post.name"/>
|
||||
<link t-att-href="'%s%s' % (base_url, post.website_url)"/>
|
||||
<id t-esc="'%s%s' % (base_url, post.website_url)"/>
|
||||
<author><name t-esc="post.sudo().author_id.name"/></author>
|
||||
<summary t-esc="html2plaintext(post.teaser)"/>
|
||||
<updated t-esc="post.write_date.replace(' ', 'T') + 'Z'"/>
|
||||
<updated t-esc="post.post_date.replace(' ', 'T') + 'Z'"/>
|
||||
</entry>
|
||||
</feed>
|
||||
</template>
|
||||
|
||||
Reference in New Issue
Block a user