Skip to content

[18.0][ADD] website_exclude_sitemap - #1177

Merged
OCA-git-bot merged 1 commit into
OCA:18.0from
BinhexTeam:18.0-add-website_exclude_sitemap
Sep 17, 2026
Merged

OCA-git-bot merged 1 commit into
OCA:18.0from
BinhexTeam:18.0-add-website_exclude_sitemap

Conversation

@edescalona

@edescalona edescalona commented Apr 17, 2026

Copy link
Copy Markdown
Contributor

@BinhexTeam

T21540

Context

Odoo includes every public website URL in the generated sitemap. Some of those URLs are useful for direct navigation but add little or no SEO value when exposed in /sitemap.xml (/livechat, feeds, apply forms, user profiles...). This module keeps the sitemap focused on strategic public pages while leaving normal website access untouched.

What it does

  • Adds a per-website sitemap_excluded_paths text field, editable from Website > Configuration > Settings > Sitemap Exclusions.
  • Overrides website._enumerate_pages() to drop the entries whose path matches one of the configured patterns.
  • Clears the cached sitemap attachments when the exclusions change, when website.page records are created or deleted, and when their url, website_published, website_indexed, date_publish or website_id changes.
  • Adds a Reload Sitemap button to clear the sitemap cache of the current website manually.

The module only affects sitemap generation: it does not unpublish pages, change access rights, or block direct access to the excluded URLs.

Pattern syntax

Values are separated by line breaks, commas or semicolons; lines starting with # are comments.

Pattern Matches Does not match
/livechat /livechat /livechat/room
/customers/ /customers, /customers/acme, /customers/acme/2024 /customers-list
/blog/*/feed /blog/news/feed /blog/a/b/feed, /blog/news
/solutions* /solutions, /solutions-cloud /solutions/cloud
/jobs/** /jobs, /jobs/apply/1, /jobs/a/b/c /jobs-list
  • * matches inside a single path segment and never crosses a /.
  • ** crosses /, matching any number of segments.
  • A pattern ending in / or /** is a prefix: it excludes that path and everything below it.
  • Any other pattern matches that exact path; the trailing slash of the URL is ignored.

The default value only covers paths present in any Odoo website (/customers/, /livechat, /blog/*/feed, /jobs/apply/, /profile/); deployment-specific paths are meant to be added by the administrator.

Implementation notes

  • Patterns are compiled to regexes cached with tools.ormcache keyed on the raw exclusions text, so they are compiled once per configuration instead of once per sitemap entry.
  • write() on website clears the registry cache when sitemap_excluded_paths changes, so the compiled patterns are invalidated too.
  • Sitemap cache clearing removes the /sitemap-<website_id>-% binary attachments.
  • Pages without website_id (shared across websites) invalidate the sitemap cache of every website.

@OCA-git-bot OCA-git-bot added series:18.0 mod:website_exclude_sitemap Module website_exclude_sitemap labels Apr 17, 2026
@edescalona
edescalona force-pushed the 18.0-add-website_exclude_sitemap branch from 6613e81 to 4fb3741 Compare April 20, 2026 15:29
@edescalona
edescalona marked this pull request as ready for review April 20, 2026 15:37
@github-actions

Copy link
Copy Markdown

There hasn't been any activity on this pull request in the past 4 months, so it has been marked as stale and it will be closed automatically if no further activity occurs in the next 30 days.
If you want this PR to never become stale, please ask a PSC member to apply the "no stale" label.

@github-actions github-actions Bot added the stale PR/Issue without recent activity, it'll be soon closed automatically. label Aug 23, 2026

@rrebollo rrebollo left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please consider my suggestions

Comment thread website_exclude_sitemap/i18n/es_ES.po Outdated
Comment thread website_exclude_sitemap/wizards/res_config_settings.py Outdated
Comment thread website_exclude_sitemap/wizards/res_config_settings.py Outdated
Comment thread website_exclude_sitemap/wizards/res_config_settings.py Outdated
@github-actions github-actions Bot removed the stale PR/Issue without recent activity, it'll be soon closed automatically. label Sep 6, 2026
@edescalona
edescalona force-pushed the 18.0-add-website_exclude_sitemap branch 2 times, most recently from f6ca34c to 24c8346 Compare September 10, 2026 20:24
@edescalona

Copy link
Copy Markdown
Contributor Author

Hi @rrebollo , thanks for the review; the suggestions have been applied. @pedrobaeza

@rrebollo rrebollo left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review. LGTM!

@pedrobaeza pedrobaeza added this to the 18.0 milestone Sep 11, 2026
@pedrobaeza

Copy link
Copy Markdown
Member

Odoo already allows to control which pages are published:

imagen

so I don't get the sense of this.

@edescalona
edescalona force-pushed the 18.0-add-website_exclude_sitemap branch from 24c8346 to 249b83e Compare September 11, 2026 13:49
@edescalona

Copy link
Copy Markdown
Contributor Author

Hi @pedrobaeza , thanks for the review. That column only affects website.page records, but the goal is to also control controller routes, which cannot be managed via the UI.

For example, with website_customer and website_blog installed, /sitemap.xml contains 45 URLs, but only one (/contactus) originates from a page. The other 44 come from controllers: /customers and its 21 routes (e.g.,
/customers/industry/..., /partners/...), /blog/<blog>/feed, /website/info, etc.

Furthermore, the standard core toggle works on a record-by-record basis, whereas here, a pattern like /customers/ or /blog/*/feed covers entire families of URLs, including those created later.

I’ve added a test (test_enumerate_pages_skips_excluded_controller_urls) that takes an enumerated URL lacking a website.page record and verifies that the pattern excludes it from the sitemap.

Does that make sense to you, or do you see another way to handle this case?

@pedrobaeza

Copy link
Copy Markdown
Member

Well, on blogs you can also mark to not track, but OK if you consider the accelerator for the main path. The problem I see with this is the UI, as if you go to the blog page/category and mark to track or not, will contradict this supra configuration.

@edescalona

Copy link
Copy Markdown
Contributor Author

@pedrobaeza I could add a note in the settings explaining that the list takes precedence over the per-record markup—and also affects the website.page view—though this wouldn't apply to the blog in this module because it would introduce unwanted dependencies. Alternatively, I could mention in description.md that this module overrides the markup. Which option do you think is best?

@pedrobaeza

Copy link
Copy Markdown
Member

OK, just mention it in the ROADMAP.md file and let people to decide.

Let website administrators exclude public URLs from /sitemap.xml through a
per-website list of paths or glob patterns, configured in Website >
Configuration > Settings.

Only sitemap generation is filtered: pages stay published and directly
accessible. The sitemap cache is cleared when the exclusions or the website
pages change, and a Reload Sitemap button clears it manually.
@edescalona
edescalona force-pushed the 18.0-add-website_exclude_sitemap branch from 249b83e to ad9964e Compare September 11, 2026 15:25
@edescalona

Copy link
Copy Markdown
Contributor Author

ready @pedrobaeza

@pedrobaeza

Copy link
Copy Markdown
Member

OK, a second review is needed.

@edescalona
edescalona requested a review from rrebollo September 11, 2026 15:37

@rrebollo rrebollo left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review. LGTM!

@jelenapoblet jelenapoblet left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This module solves a problem we have been dealing with for a long time: customizing the sitemap without modifying Odoo’s standard files.
I wasn't even aware you where working on this, I was modifying the sitemap manually with the marketing team all the time.
LGTM

@edescalona

Copy link
Copy Markdown
Contributor Author

Ready @pedrobaeza Can we merge now?

@OCA-git-bot

Copy link
Copy Markdown
Contributor

This PR has the approved label and has been created more than 5 days ago. It should therefore be ready to merge by a maintainer (or a PSC member if the concerned addon has no declared maintainer). 🤖

@pedrobaeza

Copy link
Copy Markdown
Member

/ocabot merge nobump

@OCA-git-bot

Copy link
Copy Markdown
Contributor

This PR looks fantastic, let's merge it!
Prepared branch 18.0-ocabot-merge-pr-1177-by-pedrobaeza-bump-nobump, awaiting test results.

@OCA-git-bot

Copy link
Copy Markdown
Contributor

@pedrobaeza The merge process could not be finalized, because command twine upload --disable-progress-bar --non-interactive --repository-url https://upload.pypi.org/legacy/ -u __token__ odoo_addon_website_exclude_sitemap-18.0.1.0.0.1-py3-none-any.whl failed with output:

Uploading distributions to https://upload.pypi.org/legacy/
Uploading odoo_addon_website_exclude_sitemap-18.0.1.0.0.1-py3-none-any.whl
�[33mWARNING �[0m Error during upload. Retry with the --verbose option for more details. 
�[31mERROR   �[0m HTTPError: 429 Too Many Requests from https://upload.pypi.org/legacy/  
         Too Many Requests                                                      

@pedrobaeza

Copy link
Copy Markdown
Member

@OCA/pypi-support to reserve the name

@sbidoul

sbidoul commented Sep 17, 2026

Copy link
Copy Markdown
Member

Name reserved

@pedrobaeza

Copy link
Copy Markdown
Member

/ocabot merge nobump

@OCA-git-bot

Copy link
Copy Markdown
Contributor

This PR looks fantastic, let's merge it!
Prepared branch 18.0-ocabot-merge-pr-1177-by-pedrobaeza-bump-nobump, awaiting test results.

@OCA-git-bot
OCA-git-bot merged commit cbe4716 into OCA:18.0 Sep 17, 2026
7 checks passed
@OCA-git-bot

Copy link
Copy Markdown
Contributor

Congratulations, your PR was merged at 56d401a. Thanks a lot for contributing to OCA. ❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants