Skip to content

Commit 8f7ad9a

Browse files
authored
Fix docs llms index links (#6412)
1 parent 21406ab commit 8f7ad9a

3 files changed

Lines changed: 36 additions & 2 deletions

File tree

docs/app/agent_files/_plugin.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,14 @@
2323
"ai/integrations/skills.md",
2424
}
2525

26+
LLMS_TXT_INTRO = """\
27+
# Reflex Documentation
28+
29+
> 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.
30+
31+
## Docs
32+
"""
33+
2634
LLMS_FULL_INTRO = """\
2735
# Reflex Documentation
2836
Source: {docs_home_url}
@@ -242,7 +250,12 @@ def generate_llms_txt(
242250
continue
243251
sections.setdefault(markdown_file.section, []).append(markdown_file)
244252

245-
lines = ["# Reflex", "", "## Docs", ""]
253+
lines = [
254+
LLMS_TXT_INTRO.format(
255+
llms_full_txt_url=_llms_url_for_path(Path("llms-full.txt")),
256+
).strip(),
257+
"",
258+
]
246259
for section in _ordered_sections(sections):
247260
entries = _ordered_entries(section, sections[section])
248261
lines.extend([f"### {section}", ""])

docs/app/reflex_docs/templates/docpage/docpage.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -350,6 +350,8 @@ def _copy_page_menu_item(
350350

351351

352352
DOCS_PROD_BASE = "https://reflex.dev/docs"
353+
LLMS_TXT_PATH = "/llms.txt"
354+
LLMS_FULL_TXT_PATH = "/llms-full.txt"
353355

354356

355357
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:
524526
description="Copy page as Markdown for LLMs",
525527
on_click=copy_action,
526528
),
529+
_copy_page_menu_item(
530+
icon=ui.icon("DocumentValidationIcon", size=16),
531+
title="llms-full.txt",
532+
description="View all docs as Markdown for LLMs",
533+
href=LLMS_FULL_TXT_PATH,
534+
),
527535
rx.el.div(class_name="h-px bg-secondary-4"),
528536
_copy_page_menu_item(
529537
icon=ui.icon("MessageProgrammingIcon", size=16),
@@ -759,6 +767,12 @@ def wrapper(*args, **kwargs) -> rx.Component:
759767
return rx.box(
760768
docs_navbar(),
761769
rx.el.main(
770+
rx.el.blockquote(
771+
rx.el.span("For the complete documentation index, see "),
772+
rx.el.a("llms.txt", href=LLMS_TXT_PATH),
773+
rx.el.span("."),
774+
class_name="sr-only",
775+
),
762776
rx.box(
763777
sidebar,
764778
class_name=(

docs/app/tests/test_agent_files.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,14 @@ def test_generate_llms_txt_groups_docs_at_public_root(monkeypatch):
8484
])
8585

8686
assert path == Path("llms.txt")
87-
assert content.startswith("# Reflex\n\n## Docs\n\n")
87+
assert content.startswith(
88+
"# Reflex Documentation\n\n"
89+
"> Reflex is a Python framework for building full-stack web apps. "
90+
"Use this index to find agent-readable Markdown docs, or see "
91+
"[llms-full.txt](https://reflex.dev/docs/llms-full.txt) for the "
92+
"complete docs in one file.\n\n"
93+
"## Docs\n\n"
94+
)
8895
assert "### Components\n\n" in content
8996
assert "- [Props](https://reflex.dev/docs/components/props.md)" in content
9097
assert (

0 commit comments

Comments
 (0)