Add html_baseurl to llms.txt docs links (#12)

This commit is contained in:
Jared Dillard
2025-05-18 13:37:34 -07:00
committed by GitHub
parent 77999f0923
commit cffac5615d
3 changed files with 61 additions and 1 deletions
+7 -1
View File
@@ -89,9 +89,15 @@ class FileWriter:
f.write(f"> {description}\n\n")
f.write("## Docs\n\n")
# Get base URL from config
base_url = self.config.get("html_baseurl", "/")
# Ensure base_url ends with a trailing slash
if not base_url.endswith("/"):
base_url += "/"
for docname in page_order:
title = page_titles.get(docname, docname)
f.write(f"- [{title}](/{docname}.html)\n")
f.write(f"- [{title}]({base_url}{docname}.html)\n")
logger.info(f"sphinx-llms-txt: created {output_path}")
return True