diff --git a/website_llms/README.rst b/website_llms/README.rst new file mode 100644 index 0000000000..1d5dd7972c --- /dev/null +++ b/website_llms/README.rst @@ -0,0 +1,129 @@ +================ +Website llms.txt +================ + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:e10b0e5cdee1884120e7496e4d839061b18c6618844b22cb93c486fb4b1e7c3e + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |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/licence-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_llms + :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_llms + :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 adds support for serving a /llms.txt file in the website +root. The content can be configured per website in the website settings. + +The llms.txt file provides information for Large Language Models (LLMs) +about your website, including company information, services, and content +links. + +**Table of contents** + +.. contents:: + :local: + +Usage +===== + +Configuration +------------- + +1. Go to **Website > Configuration > Settings** +2. In the **Website Info** section, find the **llms.txt Content** field +3. Enter the content you want to serve at /llms.txt +4. Save the settings + +Usage +----- + +After configuration, the /llms.txt file will be available at your +website root: + +- If content is configured: The configured content will be served +- If content is empty: A default content will be generated based on your + website information + +Example content format: + +:: + + # Your Website — Information for LLMs + + ## Company + - About: https://yourdomain.com/aboutus + - Contact: https://yourdomain.com/contactus + + ## Services + - Service 1: https://yourdomain.com/service1 + - Service 2: https://yourdomain.com/service2 + + ## Content + - Blog: https://yourdomain.com/blog + +Bug Tracker +=========== + +Bugs are tracked on `GitHub 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 `_. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= + +Authors +------- + +* Escodoo + +Contributors +------------ + +- `Escodoo `__: + + - Marcel Savegnago + +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. + +.. |maintainer-marcelsavegnago| image:: https://github.com/marcelsavegnago.png?size=40px + :target: https://github.com/marcelsavegnago + :alt: marcelsavegnago + +Current `maintainer `__: + +|maintainer-marcelsavegnago| + +This module is part of the `OCA/website `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/website_llms/__init__.py b/website_llms/__init__.py new file mode 100644 index 0000000000..f7209b1710 --- /dev/null +++ b/website_llms/__init__.py @@ -0,0 +1,2 @@ +from . import models +from . import controllers diff --git a/website_llms/__manifest__.py b/website_llms/__manifest__.py new file mode 100644 index 0000000000..a3da0d420a --- /dev/null +++ b/website_llms/__manifest__.py @@ -0,0 +1,19 @@ +{ + "name": "Website llms.txt", + "version": "18.0.1.0.0", + "category": "Website", + "summary": """ + This module adds support for serving a /llms.txt file in the website root. + The content can be configured per website in the website settings. + """, + "website": "https://github.com/OCA/website", + "author": "Escodoo, Odoo Community Association (OCA)", + "maintainers": ["marcelsavegnago"], + "depends": ["website"], + "data": [ + "views/res_config_settings.xml", + ], + "installable": True, + "application": False, + "license": "AGPL-3", +} diff --git a/website_llms/controllers/__init__.py b/website_llms/controllers/__init__.py new file mode 100644 index 0000000000..12a7e529b6 --- /dev/null +++ b/website_llms/controllers/__init__.py @@ -0,0 +1 @@ +from . import main diff --git a/website_llms/controllers/main.py b/website_llms/controllers/main.py new file mode 100644 index 0000000000..b76d2a1da0 --- /dev/null +++ b/website_llms/controllers/main.py @@ -0,0 +1,47 @@ +# Copyright 2026 - TODAY, Marcel Savegnago +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). +from odoo import http +from odoo.http import request + + +class LlmsTxtController(http.Controller): + @http.route( + "/llms.txt", + type="http", + auth="public", + website=True, + sitemap=False, + methods=["GET"], + csrf=False, + ) + def llms_txt(self, **kwargs): + """ + Serve the llms.txt file with content configured in website settings. + If no content is configured, returns a default message. + """ + website = request.website + content = website.llms_txt_content or "" + + # If content is empty, return a default message + if not content.strip(): + base_url = website.domain or request.httprequest.host_url.rstrip("/") + content = f"""# {website.name} — Information for LLMs + +## Company +- Website: {base_url} +- About: {base_url}/aboutus +- Contact: {base_url}/contactus + +## Content +- Blog: {base_url}/blog +""" + + # Ensure content ends with a newline + content = content.strip() + "\n" + + headers = [ + ("Content-Type", "text/plain; charset=utf-8"), + ("Cache-Control", "public, max-age=3600"), + ] + + return request.make_response(content, headers=headers) diff --git a/website_llms/i18n/it.po b/website_llms/i18n/it.po new file mode 100644 index 0000000000..46cc945652 --- /dev/null +++ b/website_llms/i18n/it.po @@ -0,0 +1,80 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * website_llms +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 18.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2026-06-10 15:46+0000\n" +"Last-Translator: mymage \n" +"Language-Team: none\n" +"Language: it\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Generator: Weblate 5.15.2\n" + +#. module: website_llms +#: model_terms:ir.ui.view,arch_db:website_llms.res_config_settings_view_form_inherit_website_llms +msgid "" +"# Your Website — Information for LLMs\n" +"\n" +"## Company\n" +"- About: https://yourdomain.com/aboutus\n" +"- Contact: https://yourdomain.com/contactus\n" +"\n" +"## Content\n" +"- Blog: https://yourdomain.com/blog" +msgstr "" +"# Il tuo sito web — Informazioni per i programmi LLM\n" +"\n" +"## Azienda\n" +"- Chi siamo: https://yourdomain.com/aboutus\n" +"- Contatti: https://yourdomain.com/contactus\n" +"\n" +"## Contenuti\n" +"- Blog: https://yourdomain.com/blog" + +#. module: website_llms +#: model:ir.model,name:website_llms.model_res_config_settings +msgid "Config Settings" +msgstr "Impostazioni configurazione" + +#. module: website_llms +#: model:ir.model.fields,help:website_llms.field_res_config_settings__llms_txt_content +#: model:ir.model.fields,help:website_llms.field_website__llms_txt_content +msgid "" +"Content to be served at /llms.txt. This file provides information for Large " +"Language Models (LLMs) about your website." +msgstr "" +"Il contenuto verrà servito all'indirizzo /llms.txt. Questo file fornisce " +"informazioni sui modelli linguistici di grandi dimensioni (LLM) relativi al " +"tuo sito web." + +#. module: website_llms +#: model_terms:ir.ui.view,arch_db:website_llms.res_config_settings_view_form_inherit_website_llms +msgid "" +"Content to be served at /llms.txt. This file provides\n" +" information for Large Language Models (LLMs) about your website.\n" +" Leave empty to use default content." +msgstr "" +"Il contenuto verrà visualizzato all'indirizzo /llms.txt. Questo " +"file fornisce\n" +" informazioni sui modelli linguistici di grandi " +"dimensioni (LLM) relativi al tuo sito web.\n" +" Lasciare vuoto per utilizzare il contenuto " +"predefinito." + +#. module: website_llms +#: model:ir.model,name:website_llms.model_website +msgid "Website" +msgstr "Sito web" + +#. module: website_llms +#: model:ir.model.fields,field_description:website_llms.field_res_config_settings__llms_txt_content +#: model:ir.model.fields,field_description:website_llms.field_website__llms_txt_content +#: model_terms:ir.ui.view,arch_db:website_llms.res_config_settings_view_form_inherit_website_llms +msgid "llms.txt Content" +msgstr "Contenuto llms.txt" diff --git a/website_llms/i18n/website_llms.pot b/website_llms/i18n/website_llms.pot new file mode 100644 index 0000000000..f93aa3d01e --- /dev/null +++ b/website_llms/i18n/website_llms.pot @@ -0,0 +1,60 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * website_llms +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 18.0\n" +"Report-Msgid-Bugs-To: \n" +"Last-Translator: \n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" + +#. module: website_llms +#: model_terms:ir.ui.view,arch_db:website_llms.res_config_settings_view_form_inherit_website_llms +msgid "" +"# Your Website — Information for LLMs\n" +"\n" +"## Company\n" +"- About: https://yourdomain.com/aboutus\n" +"- Contact: https://yourdomain.com/contactus\n" +"\n" +"## Content\n" +"- Blog: https://yourdomain.com/blog" +msgstr "" + +#. module: website_llms +#: model:ir.model,name:website_llms.model_res_config_settings +msgid "Config Settings" +msgstr "" + +#. module: website_llms +#: model:ir.model.fields,help:website_llms.field_res_config_settings__llms_txt_content +#: model:ir.model.fields,help:website_llms.field_website__llms_txt_content +msgid "" +"Content to be served at /llms.txt. This file provides information for Large " +"Language Models (LLMs) about your website." +msgstr "" + +#. module: website_llms +#: model_terms:ir.ui.view,arch_db:website_llms.res_config_settings_view_form_inherit_website_llms +msgid "" +"Content to be served at /llms.txt. This file provides\n" +" information for Large Language Models (LLMs) about your website.\n" +" Leave empty to use default content." +msgstr "" + +#. module: website_llms +#: model:ir.model,name:website_llms.model_website +msgid "Website" +msgstr "" + +#. module: website_llms +#: model:ir.model.fields,field_description:website_llms.field_res_config_settings__llms_txt_content +#: model:ir.model.fields,field_description:website_llms.field_website__llms_txt_content +#: model_terms:ir.ui.view,arch_db:website_llms.res_config_settings_view_form_inherit_website_llms +msgid "llms.txt Content" +msgstr "" diff --git a/website_llms/models/__init__.py b/website_llms/models/__init__.py new file mode 100644 index 0000000000..74b81abfff --- /dev/null +++ b/website_llms/models/__init__.py @@ -0,0 +1,2 @@ +from . import website +from . import res_config_settings diff --git a/website_llms/models/res_config_settings.py b/website_llms/models/res_config_settings.py new file mode 100644 index 0000000000..4c6cc08f1c --- /dev/null +++ b/website_llms/models/res_config_settings.py @@ -0,0 +1,15 @@ +# Copyright 2026 - TODAY, Marcel Savegnago +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). +from odoo import fields, models + + +class ResConfigSettings(models.TransientModel): + _inherit = "res.config.settings" + + llms_txt_content = fields.Text( + string="llms.txt Content", + related="website_id.llms_txt_content", + readonly=False, + help="Content to be served at /llms.txt. This file provides information " + "for Large Language Models (LLMs) about your website.", + ) diff --git a/website_llms/models/website.py b/website_llms/models/website.py new file mode 100644 index 0000000000..49d3fdce47 --- /dev/null +++ b/website_llms/models/website.py @@ -0,0 +1,14 @@ +# Copyright 2026 - TODAY, Marcel Savegnago +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). +from odoo import fields, models + + +class Website(models.Model): + _inherit = "website" + + llms_txt_content = fields.Text( + string="llms.txt Content", + help="Content to be served at /llms.txt. This file provides information " + "for Large Language Models (LLMs) about your website.", + translate=False, + ) diff --git a/website_llms/pyproject.toml b/website_llms/pyproject.toml new file mode 100644 index 0000000000..4231d0cccb --- /dev/null +++ b/website_llms/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["whool"] +build-backend = "whool.buildapi" diff --git a/website_llms/readme/CONTRIBUTORS.md b/website_llms/readme/CONTRIBUTORS.md new file mode 100644 index 0000000000..f618905979 --- /dev/null +++ b/website_llms/readme/CONTRIBUTORS.md @@ -0,0 +1,2 @@ +- [Escodoo](https://www.escodoo.com.br): + - Marcel Savegnago \ diff --git a/website_llms/readme/DESCRIPTION.md b/website_llms/readme/DESCRIPTION.md new file mode 100644 index 0000000000..a8c3f43be4 --- /dev/null +++ b/website_llms/readme/DESCRIPTION.md @@ -0,0 +1,6 @@ +This module adds support for serving a /llms.txt file in the website +root. The content can be configured per website in the website settings. + +The llms.txt file provides information for Large Language Models (LLMs) +about your website, including company information, services, and content +links. diff --git a/website_llms/readme/USAGE.md b/website_llms/readme/USAGE.md new file mode 100644 index 0000000000..2c17f5c54e --- /dev/null +++ b/website_llms/readme/USAGE.md @@ -0,0 +1,30 @@ +## Configuration + +1. Go to **Website \> Configuration \> Settings** +2. In the **Website Info** section, find the **llms.txt Content** field +3. Enter the content you want to serve at /llms.txt +4. Save the settings + +## Usage + +After configuration, the /llms.txt file will be available at your +website root: + +- If content is configured: The configured content will be served +- If content is empty: A default content will be generated based on your + website information + +Example content format: + + # Your Website — Information for LLMs + + ## Company + - About: https://yourdomain.com/aboutus + - Contact: https://yourdomain.com/contactus + + ## Services + - Service 1: https://yourdomain.com/service1 + - Service 2: https://yourdomain.com/service2 + + ## Content + - Blog: https://yourdomain.com/blog diff --git a/website_llms/static/description/icon.png b/website_llms/static/description/icon.png new file mode 100644 index 0000000000..1dcc49c24f Binary files /dev/null and b/website_llms/static/description/icon.png differ diff --git a/website_llms/static/description/index.html b/website_llms/static/description/index.html new file mode 100644 index 0000000000..69bcbd246e --- /dev/null +++ b/website_llms/static/description/index.html @@ -0,0 +1,474 @@ + + + + + +Website llms.txt + + + +
+

Website llms.txt

+ + +

Beta License: AGPL-3 OCA/website Translate me on Weblate Try me on Runboat

+

This module adds support for serving a /llms.txt file in the website +root. The content can be configured per website in the website settings.

+

The llms.txt file provides information for Large Language Models (LLMs) +about your website, including company information, services, and content +links.

+

Table of contents

+ +
+

Usage

+
+

Configuration

+
    +
  1. Go to Website > Configuration > Settings
  2. +
  3. In the Website Info section, find the llms.txt Content field
  4. +
  5. Enter the content you want to serve at /llms.txt
  6. +
  7. Save the settings
  8. +
+
+
+

Usage

+

After configuration, the /llms.txt file will be available at your +website root:

+
    +
  • If content is configured: The configured content will be served
  • +
  • If content is empty: A default content will be generated based on your +website information
  • +
+

Example content format:

+
+# Your Website — Information for LLMs
+
+## Company
+- About: https://yourdomain.com/aboutus
+- Contact: https://yourdomain.com/contactus
+
+## Services
+- Service 1: https://yourdomain.com/service1
+- Service 2: https://yourdomain.com/service2
+
+## Content
+- Blog: https://yourdomain.com/blog
+
+
+
+
+

Bug Tracker

+

Bugs are tracked on GitHub 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.

+

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

+
+
+

Credits

+
+

Authors

+
    +
  • Escodoo
  • +
+
+
+

Contributors

+ +
+
+

Maintainers

+

This module is maintained by the OCA.

+ +Odoo Community Association + +

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.

+

Current maintainer:

+

marcelsavegnago

+

This module is part of the OCA/website project on GitHub.

+

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

+
+
+
+ + diff --git a/website_llms/tests/__init__.py b/website_llms/tests/__init__.py new file mode 100644 index 0000000000..b5a3200448 --- /dev/null +++ b/website_llms/tests/__init__.py @@ -0,0 +1 @@ +from . import test_controller diff --git a/website_llms/tests/test_controller.py b/website_llms/tests/test_controller.py new file mode 100644 index 0000000000..3403328002 --- /dev/null +++ b/website_llms/tests/test_controller.py @@ -0,0 +1,117 @@ +# Copyright 2026 - TODAY, Marcel Savegnago +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from odoo.tests.common import HttpCase, tagged + + +@tagged("post_install", "-at_install") +class TestLlmsTxtController(HttpCase): + def setUp(self): + super().setUp() + self.website = self.env["website"].sudo().get_current_website() + + def _wait_remaining_requests(self, timeout=10): + # Bypass this to prevent the test suite from hanging for 10 seconds per test. + pass + + def test_manifest_coverage(self): + """Test to execute the manifest file to satisfy coverage.""" + import importlib.util + import os + + manifest_path = os.path.join( + os.path.dirname(os.path.dirname(__file__)), "__manifest__.py" + ) + spec = importlib.util.spec_from_file_location( + "website_llms.manifest", manifest_path + ) + manifest_mod = importlib.util.module_from_spec(spec) + spec.loader.exec_module(manifest_mod) + self.assertTrue(isinstance(manifest_mod.__dict__, dict)) + + def test_llms_txt_with_configured_content(self): + """Test /llms.txt endpoint with configured content.""" + # Configure custom content + custom_content = """# My Website — Information for LLMs + +## Company +- About: https://example.com/about +- Contact: https://example.com/contact + +## Services +- Service 1: https://example.com/service1 +""" + self.website.llms_txt_content = custom_content + + # Make request + response = self.url_open("/llms.txt", timeout=20) + + # Assertions + self.assertEqual(response.status_code, 200) + self.assertEqual( + response.headers.get("Content-Type"), + "text/plain; charset=utf-8", + ) + self.assertEqual( + response.headers.get("Cache-Control"), + "public, max-age=3600", + ) + # Content should end with newline + self.assertTrue(response.text.endswith("\n")) + # Should contain configured content + self.assertIn("My Website", response.text) + self.assertIn("https://example.com/about", response.text) + + def test_llms_txt_without_content(self): + """Test /llms.txt endpoint without configured content (default).""" + # Ensure no content is configured + self.website.llms_txt_content = False + + # Make request + response = self.url_open("/llms.txt", timeout=20) + + # Assertions + self.assertEqual(response.status_code, 200) + self.assertEqual( + response.headers.get("Content-Type"), + "text/plain; charset=utf-8", + ) + self.assertEqual( + response.headers.get("Cache-Control"), + "public, max-age=3600", + ) + # Content should end with newline + self.assertTrue(response.text.endswith("\n")) + # Should contain default content with website name + self.assertIn(self.website.name, response.text) + self.assertIn("Information for LLMs", response.text) + self.assertIn("## Company", response.text) + self.assertIn("## Content", response.text) + + def test_llms_txt_with_empty_content(self): + """Test /llms.txt endpoint with empty content (should use default).""" + # Set empty content + self.website.llms_txt_content = "" + + # Make request + response = self.url_open("/llms.txt", timeout=20) + + # Assertions + self.assertEqual(response.status_code, 200) + # Should contain default content + self.assertIn(self.website.name, response.text) + self.assertIn("Information for LLMs", response.text) + + def test_llms_txt_with_whitespace_content(self): + """Test /llms.txt endpoint with whitespace-only content (should use default).""" + # Set whitespace-only content + self.website.llms_txt_content = " \n\t " + + # Make request + response = self.url_open("/llms.txt", timeout=20) + + # Assertions + self.assertEqual(response.status_code, 200) + # Should contain default content (whitespace is stripped) + self.assertIn(self.website.name, response.text) + self.assertIn("Information for LLMs", response.text) diff --git a/website_llms/views/res_config_settings.xml b/website_llms/views/res_config_settings.xml new file mode 100644 index 0000000000..894af6f455 --- /dev/null +++ b/website_llms/views/res_config_settings.xml @@ -0,0 +1,38 @@ + + + + + res.config.settings + + + + +
+
+
+
+
+
+
+
+