Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

1

Way to prevent entry of a site in sitemap.xml

By
Mathias Neef
on 8/15/14, 6:29 AM 1,952 views

Is there a way to prevent an entry of a specific site in sitemap.xml, eg with a short bit of code in the controller?

1
Yves
On 4/21/15, 5:52 AM

Supplement to the question

 (It's a shame you can not really join in here without karma. Unfortunately, I still know too little of odoo to answer questions. I would like to actually extends the question with a comment. I'll do it here...)


I also look for a way to adjust the sitemap.xml.

first I'm going to Settings> Technical> user-interface> views. With the filter "sitemap" I get the templates. I assume that there changes can be made.

Problem is: I have tried many things but no matter what I do, it does not change the output. Must there somewhere a cache are deleted?

I suspect something like that could help to output not all pages:

 <?xml version="1.0"?>
<t t-name="website.sitemap_locs">
  <t t-if="page.get('lastmod', False)">
    <url t-foreach="locs" t-as="page">
      <loc><t t-esc="url_root"/><t t-esc="page['loc']"/></loc>
      <lastmod t-esc="page['lastmod']"/>
      <t t-if="page.get('priority', False)">
	<priority t-esc="page['priority']"/>
      </t>
      <t t-if="page.get('changefreq', False)">
	<changefreq t-esc="page['changefreq']"/>
      </t>
    </url>
  </t>
</t>

so that only pages are output that have already been edited. Surely it would be even better way. The ideal would be a setting in the metadata of the page self.

After all, such sites should never be displayed:

/shop/payment/validate
/shop/confirm_order 
/shop/confirmation
/crm/contactus (second Contact Page????)
/shop/product/inactive-7  (inactive product end in 403)
/partners/country/amerikanisch-samoa-12 (not used Countrys)

0
hofrob
On 5/4/15, 6:43 AM

Hello odoos,

There's definitely room for improvement. According to a comment in enumerate_page (https://github.com/odoo/odoo/blob/8.0/addons/website/models/website.py#L370) every template that's marked as a page will get returned. All pages returned will then be used to create the sitemap (https://github.com/odoo/odoo/blob/8.0/addons/website/controllers/main.py#L89).

So the only way to prevent pages to be listed in the sitemap right now, will be to extend the "website" model in-place (https://www.odoo.com/documentation/8.0/reference/orm.html#inheritance-and-extension). Add a property that allows you to specify what should happen with the page and change/override/extend "enumerate_pages".

Regards, hofrob

P.S.: I hope markdown is the correct way to add links to a comment

edit: Is there really no way of using some kind of markup in comments/answers?!

edit2: I created a quick and dirty solution for this here: https://github.com/TechnikumWienAcademy/Odoo-Sitemap-Module

Once your sitemap is refreshed, you will see database entries for every URL in website_sitemap_extended. Change sitemap_visible to "FALSE" to prevent listing.

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 8/15/14, 6:29 AM
Seen: 1952 times
Last updated: 5/5/15, 5:06 AM