[IMP] SEO sitemap.xml + robots.txt
bzr revid: ddm@openerp.com-20130923134240-4qx4pyfv2rl65xyz
This commit is contained in:
parent
d910b8c533
commit
5c9bdf1dcb
|
@ -271,4 +271,12 @@ class Website(openerp.addons.web.controllers.main.Home):
|
|||
def kanban(self, **post):
|
||||
return request.website.kanban_col(**post)
|
||||
|
||||
@website.route(['/robots.txt'], type='http', auth="public")
|
||||
def robots(self):
|
||||
return request.website.render('website.robots', {'url_root': request.httprequest.url_root})
|
||||
|
||||
@website.route(['/sitemap.xml'], type='http', auth="public")
|
||||
def sitemap(self):
|
||||
return request.website.render('website.sitemap', {'pages': request.website.list_pages()})
|
||||
|
||||
# vim:expandtab:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
|
|
@ -386,5 +386,17 @@
|
|||
</tbody>
|
||||
</table>
|
||||
</template>
|
||||
<template id="robots">
|
||||
# robotstxt.org/
|
||||
User-agent: *
|
||||
Sitemap: <t t-esc="url_root"/>sitemap.xml
|
||||
</template>
|
||||
<template id="sitemap">
|
||||
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
|
||||
<t t-foreach="pages" t-as="page">
|
||||
<url t-esc="page['url']"/>
|
||||
</t>
|
||||
</urlset>
|
||||
</template>
|
||||
</data>
|
||||
</openerp>
|
||||
|
|
|
@ -172,7 +172,7 @@ class website(osv.osv):
|
|||
]
|
||||
}
|
||||
|
||||
def list_pages(self, cr, uid, context=None):
|
||||
def list_pages(self, cr, uid, ids, context=None):
|
||||
""" Available pages in the website/CMS. This is mostly used for links
|
||||
generation and can be overridden by modules setting up new HTML
|
||||
controllers for dynamic pages (e.g. blog).
|
||||
|
|
Loading…
Reference in New Issue