5ceda30e628308030b5a1055e153cea3d6211b24
When a crawler (eg Googlebot) come to visit your website, it grants you
a limited amount of time and ressources, it's called "Crawler budget".
If you have millions of URLs, it won't go through each one of them in a
single go.
The best you can help those crawler, the better. The sitemap `lastmod`
attribute, despite not being fully respected and trusted by crawlers, is
one of the way you can still try to help them.
For website.pages, it's already done. But for controllers, it's not an
easy thing to do as we have no way to automatically figure what are the
relevant records/fields to look at to know the last update date.
For instance, on the event pages, some pages content are mostly stored
inside an `ir.ui.view`, but the title, hours etc are part of the event
itself.
We can't just say "we take the last write_date of the record", it's
wrong in 2 ways:
- The first one I just explained where we wouldn't be able to easily get
all the elements part of the page rendering and would miss a possible
element write_date, leaving an outdated date in `lastmod`.
- Then, there is another issue (which is more problematic in stable):
the `write_date` is often updated for non website related purposes.
For instance, on /partners/<partner>, we wouldn't be able to use the
write date on odoo.com as the partners shown there (having a grade)
are update every weeks in average, because of many fields, for
instance: commission_plan_id, partner_weight, grade_id, ...
Still, there is a quick win possible in stable about forum posts which
are not impacted by the 2 issues explained above:
- The `write_date` doesn't seem to be updated too frequently for
(sitemap) irrelevant reasons. We can ensure to show a date which is
only modified when the forum.post page really gets a modification.
- All the forum.post information displayed on the page are stored inside
the forum.post itself.
This commit is thus adding the `lastmod` on forum.post URLs in the
sitemap in hope of not making Google waste time on (very) old posts.
Note: we don't use the `last_activity_date` as it wouldn't be updated in
case of the post `content` or `name` being modified for instance,
which would be wrong.
Some metrics: On odoo.com, out of the 83499 forum posts having a
`last_activity_date < 2023-10-01`, only 2335 have a `write_date`
after `2023-10-01`. It means that those two fields are actually
giving almost the same results.
Using `write_date` is thus the best choice: not impacted by the
issues mentioned above and cover all relevant record change, as
opposed to `last_activity_date`.
Note: the `lastmod` has to be trustworthy and correct, if you set wrong
or outdated info inside it, Google won't trust you/it anymore.
closes odoo/odoo#155197
Signed-off-by: Jérémy Kersten <jke@odoo.com>
…
…
…
…
…
Odoo
Odoo is a suite of web based open source business apps.
The main Odoo Apps include an Open Source CRM, Website Builder, eCommerce, Warehouse Management, Project Management, Billing & Accounting, Point of Sale, Human Resources, Marketing, Manufacturing, ...
Odoo Apps can be used as stand-alone applications, but they also integrate seamlessly so you get a full-featured Open Source ERP when you install several Apps.
Getting started with Odoo
For a standard installation please follow the Setup instructions from the documentation.
To learn the software, we recommend the Odoo eLearning, or Scale-up, the business game. Developers can start with the developer tutorials
Languages
Python
49.6%
JavaScript
47.8%
SCSS
2%
CSS
0.3%
HTML
0.2%