Search code examples
webcontent-management-systemodookeywordsitemap.xml

Where is odoo stored keywords and urls


I cannot understand where stored keywords and urls. For example in module website exist class website_seo_metadata. It has such columns:

'website_meta_title': fields.char("Website meta title", translate=True),
'website_meta_description': fields.text("Website meta description", translate=True),
'website_meta_keywords': fields.char("Website meta keywords", translate=True),

When I added some keywords for page records not exist in DB. I can not understand where stored urls for pages. I know, if I create route:

 @http.route('/contacts/', type='http', auth="public", website=True)

this path was added to sitemap.xml For generate sitemap.xml used sitemap_xml_index method:

@http.route('/sitemap.xml', type='http', auth="public", website=True)
    def sitemap_xml_index(self):
        current_website = request.website
        cr, uid, context = request.cr, openerp.SUPERUSER_ID, request.context
        ira = request.registry['ir.attachment']
        iuv = request.registry['ir.ui.view']

But in this tables not present any one url. I can not understanding how it generate path for all pages. Where is it data stored? I wrote own module but pages from it not present in sitemap.xml and keywords not correctly saved and displayed. I tried extend my models such as:

class pr_info_pages(models.Model):
    _name = 'pr_filials.pr_info_pages'
    _inherit = ['mail.thread', 'website.seo.metadata', 'website.published.mixin']

but nothing changed... How i can add my urls to sitemap and normally store keywords?


Solution

  • For keywords you need use in model:

    _inherit = ['mail.thread', 'website.seo.metadata']
    

    Also, when you generate page data you need put to page 'main_object'. This is the dictionary element that contains the object of your model. For example:

    return http.request.render(_your_template_, {
                'page_data': page_data,
                'main_object': _object_
            })