diff libervia/pages/u/page_meta.py @ 1171:469d0de8da0e

pages (blog, u): added atom feed link in "links" template data.
author Goffi <goffi@goffi.org>
date Fri, 26 Apr 2019 08:42:27 +0200
parents 4e716967893a
children 67ec22356457
line wrap: on
line diff
--- a/libervia/pages/u/page_meta.py	Fri Apr 12 14:12:53 2019 +0200
+++ b/libervia/pages/u/page_meta.py	Fri Apr 26 08:42:27 2019 +0200
@@ -30,6 +30,15 @@
     target_jid = jid.JID(target_jid)
     data[u"service"] = target_jid
 
+    # if URL is parsed here, we'll have atom.xml available and we need to
+    # add the link to the page
+    atom_url = self.getSubPageURL(request, u'user_blog_feed_atom')
+    request.template_data.setdefault(u'links', []).append({
+        u"href": atom_url,
+        u"type": "application/atom+xml",
+        u"rel": "alternate",
+        u"title": "{target_profile}'s blog".format(target_profile=target_profile)})
+
 
 @defer.inlineCallbacks
 def prepare_render(self, request):