Managing sitemaps for the website
A website’s sitemaps are crucial for any website. The search engine will use website sitemaps to index the pages of a website. In this recipe, we will add hostel details pages to the sitemap.
Getting ready
For this recipe, we will be using the my_hostel
module from the previous recipe. If you want to check the current sitemap in Odoo, open <your_odoo_server_url>/sitemap.xml
in your browser.
How to do it...
Follow these steps to modify a hostel’s page to sitemap.xml
:
- Import the methods in
main.py
, as follows:from odoo.addons.http_routing.models.ir_http import slug from odoo.addons.website.models.ir_http import sitemap_qs2dom
- Add the
sitemap_hostels
method tomain.py
, as follows:Â Â Â Â Â def sitemap_hostels(env, rule, qs): Â Â Â Â Â Â Â Â Â Hostels = env['hostel.hostel'] Â Â Â Â Â Â Â Â Â dom = sitemap_qs2dom...