diff --git a/setup/website_llms/odoo/addons/website_llms b/setup/website_llms/odoo/addons/website_llms new file mode 120000 index 0000000000..46a757f2c4 --- /dev/null +++ b/setup/website_llms/odoo/addons/website_llms @@ -0,0 +1 @@ +../../../../website_llms \ No newline at end of file diff --git a/setup/website_llms/setup.py b/setup/website_llms/setup.py new file mode 100644 index 0000000000..28c57bb640 --- /dev/null +++ b/setup/website_llms/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +) diff --git a/website_llms/README.rst b/website_llms/README.rst new file mode 100644 index 0000000000..528f7c2fdc --- /dev/null +++ b/website_llms/README.rst @@ -0,0 +1,126 @@ +================ +Website llms.txt +================ + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:8a9926d7200ad9e863b35eef0281a85bde4f76ef4ed12ee7e35ffced4b32165d + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |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/16.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-16-0/website-16-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=16.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..56c37698af --- /dev/null +++ b/website_llms/__manifest__.py @@ -0,0 +1,19 @@ +{ + "name": "Website llms.txt", + "version": "16.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/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/readme/CONTRIBUTORS.rst b/website_llms/readme/CONTRIBUTORS.rst new file mode 100644 index 0000000000..ae453a60bd --- /dev/null +++ b/website_llms/readme/CONTRIBUTORS.rst @@ -0,0 +1,3 @@ +* `Escodoo `_: + + * Marcel Savegnago diff --git a/website_llms/readme/DESCRIPTION.rst b/website_llms/readme/DESCRIPTION.rst new file mode 100644 index 0000000000..ee2785cf19 --- /dev/null +++ b/website_llms/readme/DESCRIPTION.rst @@ -0,0 +1,5 @@ +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. \ No newline at end of file diff --git a/website_llms/readme/USAGE.rst b/website_llms/readme/USAGE.rst new file mode 100644 index 0000000000..2958811b94 --- /dev/null +++ b/website_llms/readme/USAGE.rst @@ -0,0 +1,32 @@ +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/index.html b/website_llms/static/description/index.html new file mode 100644 index 0000000000..64465ce2af --- /dev/null +++ b/website_llms/static/description/index.html @@ -0,0 +1,469 @@ + + + + + +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..39db4106cc --- /dev/null +++ b/website_llms/tests/test_controller.py @@ -0,0 +1,97 @@ +# Copyright 2026 - TODAY, Marcel Savegnago +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from odoo.tests.common import HttpCase + + +class TestLlmsTxtController(HttpCase): + def setUp(self): + super().setUp() + self.website = self.env["website"].sudo().get_current_website() + + 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..3f963f8d8e --- /dev/null +++ b/website_llms/views/res_config_settings.xml @@ -0,0 +1,34 @@ + + + + + res.config.settings + + + +
+
+
+
+
+