Skip to content

feat: add --url-path-pattern flag for llms.txt .md link mapping - #101

Merged
dacharyc merged 1 commit into
mainfrom
feat/url-path-pattern
Aug 9, 2026
Merged

feat: add --url-path-pattern flag for llms.txt .md link mapping#101
dacharyc merged 1 commit into
mainfrom
feat/url-path-pattern

Conversation

@dacharyc

@dacharyc dacharyc commented Aug 9, 2026

Copy link
Copy Markdown
Member

Summary

  • Adds a urlPathPattern option (--url-path-pattern CLI flag, options.urlPathPattern in config) controlling how llms.txt .md links map to the site's page URLs:
    • clean (default): strip the extension (/guide.md/guide), the existing behavior
    • html: replace the extension (/guide.md/guide.html) for sites that serve real filenames; .html.md links don't get doubled
    • md: keep the .md URL as the canonical page URL for sites that serve markdown directly
  • Threads the pattern through llms.txt link normalization (extractLinksFromLlmsTxtFiles) and every check that converts .md URLs to page URLs (llms-txt-directive-html, llms-txt-directive-md, content-negotiation, markdown-content-parity)
  • Validates the value in both runner options and config loading, and documents the flag in the CLI reference

Closes #95

Test plan

  • Unit tests for toHtmlUrl under html and md patterns (including the .html.md non-doubling case)
  • Integration tests: llms.txt .md links resolve to .html page URLs / stay .md per pattern
  • Validation tests for runner options and config enum checks
  • npm test (1310 tests), npm run lint, prettier clean

afdocs assumed clean URLs when deriving page URLs from llms.txt .md
links, stripping the extension (/guide.md -> /guide). Sites that serve
real filenames expect /guide.html, so the derived URL could 404 or
redirect and skew results in ways a real agent wouldn't hit.

Add a urlPathPattern option (--url-path-pattern, or urlPathPattern in
config) with three values: clean (default, strip extension), html
(replace with .html, without doubling .html.md links), and md (keep the
.md URL as the canonical page URL). The pattern threads through llms.txt
link normalization and every check that converts .md URLs to page URLs.

Closes #95
@dacharyc
dacharyc merged commit 08eed5a into main Aug 9, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add a flag to specify url path pattern

1 participant