Metadata-Version: 2.1
Name: odoo-addon-website_exclude_sitemap
Version: 18.0.1.0.0.1
Requires-Python: >=3.10
Requires-Dist: odoo==18.0.*
Summary: Exclude addresses from the sitemap.xml file according to the values defined in the configuration
Home-page: https://github.com/OCA/website
License: AGPL-3
Author: Binhex, Odoo Community Association (OCA)
Author-email: support@odoo-community.org
Classifier: Programming Language :: Python
Classifier: Framework :: Odoo
Classifier: Framework :: Odoo :: 18.0
Classifier: License :: OSI Approved :: GNU Affero General Public License v3
Description-Content-Type: text/x-rst

.. image:: https://odoo-community.org/readme-banner-image
   :target: https://odoo-community.org/get-involved?utm_source=readme
   :alt: Odoo Community Association

=======================
Website Exclude Sitemap
=======================

.. 
   !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
   !! This file is generated by oca-gen-addon-readme !!
   !! changes will be overwritten.                   !!
   !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
   !! source digest: sha256:1ccf5cfe1f1d791baa26c077f275917693c8d97994ffa35c33769fd3ddd03198
   !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
    :target: https://odoo-community.org/page/development-status
    :alt: Beta
.. |badge2| image:: https://img.shields.io/badge/license-AGPL--3-blue.png
    :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
    :alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fwebsite-lightgray.png?logo=github
    :target: https://github.com/OCA/website/tree/18.0/website_exclude_sitemap
    :alt: OCA/website
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
    :target: https://translation.odoo-community.org/projects/website-18-0/website-18-0-website_exclude_sitemap
    :alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
    :target: https://runboat.odoo-community.org/builds?repo=OCA/website&target_branch=18.0
    :alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|

This module lets website administrators exclude public website URLs from
``/sitemap.xml``.

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

It also clears the cached sitemap when website pages are created,
deleted, or their URL changes, so sitemap URLs are refreshed in the next
sitemap generation.

**Table of contents**

.. contents::
   :local:

Use Cases / Context
===================

Odoo includes public website URLs in the generated sitemap.

Some public URLs can be useful for direct navigation but add little or
no SEO value when exposed in ``/sitemap.xml``.

This module was created to keep the sitemap focused on strategic public
pages while leaving normal website access untouched.

Configuration
=============

Configure sitemap exclusions:

1. Go to **Website > Configuration > Settings**.
2. Locate the **Sitemap Exclusions** setting.
3. Enter one or more paths or glob patterns.
4. Save the settings.

Values can be separated by:

- line breaks;
- commas;
- semicolons.

For example, these values are equivalent:

.. code:: text

   /customers/
   /livechat
   /blog/*/feed
   /jobs/apply/
   /profile/

.. code:: text

   /customers/, /livechat, /blog/*/feed, /jobs/apply/, /profile/

.. code:: text

   /customers/; /livechat; /blog/*/feed
   /jobs/apply/, /profile/

Lines starting with ``#`` are comments.

See the usage section for the full pattern syntax: ``*`` matches inside
one path segment, ``**`` crosses ``/``, and a pattern ending in ``/`` or
in ``/**`` excludes that path and everything below it.

The default value only covers paths that any Odoo website has. Add the
paths that are specific to your own deployment, for example:

.. code:: text

   /website/info
   /create-container-error
   /machine-creation

``/website/info`` is already left out of the sitemap by the core when
its view is inactive; add it here when that view stays active.

Use the **Reload Sitemap** button in the same settings block to clear
the cached sitemap manually.

Usage
=====

Sitemap exclusions:

1. Create or publish website pages as usual.

2. Configure the paths or patterns to exclude in **Website >
   Configuration > Settings > Sitemap Exclusions**.

   |Sitemap exclusions|

3. Open ``/sitemap.xml``.

4. Confirm that excluded URLs are absent and non-excluded public pages
   are still present.

Pattern syntax:

+------------------+--------------------------+-------------------------+
| Pattern          | Matches                  | Does not match          |
+==================+==========================+=========================+
| ``/livechat``    | ``/livechat``            | ``/livechat/room``      |
+------------------+--------------------------+-------------------------+
| ``/customers/``  | ``/customers``,          | ``/customers-list``     |
|                  | ``/customers/acme``,     |                         |
|                  | ``/customers/acme/2024`` |                         |
+------------------+--------------------------+-------------------------+
| ``/blog/*/feed`` | ``/blog/news/feed``      | ``/blog/a/b/feed``,     |
|                  |                          | ``/blog/news``          |
+------------------+--------------------------+-------------------------+
| ``/solutions*``  | ``/solutions``,          | ``/solutions/cloud``    |
|                  | ``/solutions-cloud``     |                         |
+------------------+--------------------------+-------------------------+
| ``/jobs/**``     | ``/jobs``,               | ``/jobs-list``          |
|                  | ``/jobs/apply/1``,       |                         |
|                  | ``/jobs/a/b/c``          |                         |
+------------------+--------------------------+-------------------------+

In short:

- ``*`` matches inside a single path segment; it never crosses a ``/``.
- ``**`` crosses ``/``, so it matches any number of segments.
- A pattern ending in ``/`` or in ``/**`` 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, so ``/livechat`` and ``/livechat/`` are the same path.

Example:

- configure ``/customers/``;
- publish a page at ``/customers``;
- publish another page at ``/customers/other``;
- open ``/sitemap.xml``.

Both URLs are excluded, because ``/customers/`` is a prefix. Use
``/customers`` without the trailing slash to exclude only the first one.

Ways to update the sitemap.xml:

1. The sitemap cache is automatically cleared when website pages are
   created or deleted, and when their URL, publication state,
   indexation, publication date or website changes.

2. The manual **Reload Sitemap** button can be used when a forced
   sitemap cache clear is needed.

   |Reload manual sitemap|

.. |Sitemap exclusions| image:: https://raw.githubusercontent.com/OCA/website/18.0/website_exclude_sitemap/static/img/readme/config_sitemap_exclusions.png
.. |Reload manual sitemap| image:: https://raw.githubusercontent.com/OCA/website/18.0/website_exclude_sitemap/static/img/readme/reload_manual_sitemap.png

Known issues / Roadmap
======================

The exclusion list is a denylist evaluated after Odoo has collected
every sitemap source, so it only removes URLs, never adds them. When a
record is marked as indexed but its URL matches an exclusion pattern,
the pattern wins and the URL stays out of ``/sitemap.xml``.

Nothing warns about that in the record itself: a page whose **Indexed**
toggle is on, or a published blog post, gives no hint that a global
pattern is keeping it out of the sitemap. The only place where the
exclusions are visible is \**Website

   Configuration > Settings*\*.

A future version could show the conflict where the record is edited, for
example a message next to the **Indexed** toggle of ``website.page``.
Covering models from other modules, such as ``blog.post``, belongs in
bridge modules instead, to keep this module depending on ``website``
alone.

Bug Tracker
===========

Bugs are tracked on `GitHub Issues <https://github.com/OCA/website/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us to smash it by providing a detailed and welcomed
`feedback <https://github.com/OCA/website/issues/new?body=module:%20website_exclude_sitemap%0Aversion:%2018.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

Do not contact contributors directly about support or help with technical issues.

Credits
=======

Authors
-------

* Binhex

Contributors
------------

- `Binhex <https://www.binhex.cloud>`__:

  - Edilio Escalona Almira e.escalona@binhex.cloud

Maintainers
-----------

This module is maintained by the OCA.

.. image:: https://odoo-community.org/logo.png
   :alt: Odoo Community Association
   :target: https://odoo-community.org

OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.

This module is part of the `OCA/website <https://github.com/OCA/website/tree/18.0/website_exclude_sitemap>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
