From c6e60d58205847315b3c9c7c88fb3584861a2998 Mon Sep 17 00:00:00 2001 From: Alek Petuskey Date: Tue, 28 Apr 2026 13:34:45 -0700 Subject: [PATCH] Fix docs llms index links --- docs/app/agent_files/_plugin.py | 15 ++++++++++++++- docs/app/reflex_docs/templates/docpage/docpage.py | 14 ++++++++++++++ docs/app/tests/test_agent_files.py | 9 ++++++++- 3 files changed, 36 insertions(+), 2 deletions(-) diff --git a/docs/app/agent_files/_plugin.py b/docs/app/agent_files/_plugin.py index 05bc22f2ebf..d7903210383 100644 --- a/docs/app/agent_files/_plugin.py +++ b/docs/app/agent_files/_plugin.py @@ -23,6 +23,14 @@ "ai/integrations/skills.md", } +LLMS_TXT_INTRO = """\ +# Reflex Documentation + +> Reflex is a Python framework for building full-stack web apps. Use this index to find agent-readable Markdown docs, or see [llms-full.txt]({llms_full_txt_url}) for the complete docs in one file. + +## Docs +""" + LLMS_FULL_INTRO = """\ # Reflex Documentation Source: {docs_home_url} @@ -242,7 +250,12 @@ def generate_llms_txt( continue sections.setdefault(markdown_file.section, []).append(markdown_file) - lines = ["# Reflex", "", "## Docs", ""] + lines = [ + LLMS_TXT_INTRO.format( + llms_full_txt_url=_llms_url_for_path(Path("llms-full.txt")), + ).strip(), + "", + ] for section in _ordered_sections(sections): entries = _ordered_entries(section, sections[section]) lines.extend([f"### {section}", ""]) diff --git a/docs/app/reflex_docs/templates/docpage/docpage.py b/docs/app/reflex_docs/templates/docpage/docpage.py index 0982390e169..06c0915752b 100644 --- a/docs/app/reflex_docs/templates/docpage/docpage.py +++ b/docs/app/reflex_docs/templates/docpage/docpage.py @@ -350,6 +350,8 @@ def _copy_page_menu_item( DOCS_PROD_BASE = "https://reflex.dev/docs" +LLMS_TXT_PATH = "/llms.txt" +LLMS_FULL_TXT_PATH = "/llms-full.txt" def _build_prefill_url(base_url: str, path: str, action: str) -> str: @@ -524,6 +526,12 @@ def _copy_page_button(doc_content: str, path: str = "") -> rx.Component: description="Copy page as Markdown for LLMs", on_click=copy_action, ), + _copy_page_menu_item( + icon=ui.icon("DocumentValidationIcon", size=16), + title="llms-full.txt", + description="View all docs as Markdown for LLMs", + href=LLMS_FULL_TXT_PATH, + ), rx.el.div(class_name="h-px bg-secondary-4"), _copy_page_menu_item( icon=ui.icon("MessageProgrammingIcon", size=16), @@ -759,6 +767,12 @@ def wrapper(*args, **kwargs) -> rx.Component: return rx.box( docs_navbar(), rx.el.main( + rx.el.blockquote( + rx.el.span("For the complete documentation index, see "), + rx.el.a("llms.txt", href=LLMS_TXT_PATH), + rx.el.span("."), + class_name="sr-only", + ), rx.box( sidebar, class_name=( diff --git a/docs/app/tests/test_agent_files.py b/docs/app/tests/test_agent_files.py index 3a411b7a11c..4bc8ecb1345 100644 --- a/docs/app/tests/test_agent_files.py +++ b/docs/app/tests/test_agent_files.py @@ -84,7 +84,14 @@ def test_generate_llms_txt_groups_docs_at_public_root(monkeypatch): ]) assert path == Path("llms.txt") - assert content.startswith("# Reflex\n\n## Docs\n\n") + assert content.startswith( + "# Reflex Documentation\n\n" + "> Reflex is a Python framework for building full-stack web apps. " + "Use this index to find agent-readable Markdown docs, or see " + "[llms-full.txt](https://reflex.dev/docs/llms-full.txt) for the " + "complete docs in one file.\n\n" + "## Docs\n\n" + ) assert "### Components\n\n" in content assert "- [Props](https://reflex.dev/docs/components/props.md)" in content assert (