Repository navigation
Release 2.3.1-beta.1 - #488
Open
sohail2721 wants to merge 3 commits into
Open
sohail2721 wants to merge 3 commits into
sohail2721 wants to merge 3 commits into
Conversation
Release 2.3.0
…s sub-path (#486) A portal hosted under a sub-path, such as a preview at `/p/<id>/` or `acme.github.io/docs`, linked the template's "Agent-Friendly Docs" card to the host's root, where there is no file. ## What was wrong The default content links the card like this: ```mdx <Card title="Agent-Friendly Docs" href="/llms.txt" external /> ``` fumadocs-core's `Link` renders an `external` link as a plain `<a target="_blank">` and never hands it to the router. The router is what adds the base path. Under `/p/abc123/`, the card was `href="/llms.txt"` and got a 404, while the SDKs card beside it was `/p/abc123/sdks`. At the root of a domain nothing was wrong. ## The fix An external card now reads a `/…` address the way the rest of the portal does. `external` changes only how the card opens: a plain link, in a new tab. - **One rule, in one place.** `underBase` in `lib/base-path.ts` puts any root-relative address under the base, as the router does for links. It also leaves `https://…`, `//…`, `mailto:`, relative and `#` addresses as written. - The Card override in `components/mdx.tsx` uses it for external cards. - The images in API descriptions (`api-markdown.tsx`) use it too, replacing their own copy of the regex. - **It covers every file the portal serves under the path:** `llms.txt` and the other generated files, the pages' `.md` copies, files from `static/` and the `/__downloads/` zips. It also covers a page opened in a new tab. - **The prerender and the browser both get it.** Fumadocs' server MDX entry reuses the same components. - **Existing build directories need no change,** because the fix is in rendering, not in their content. **A change in behavior, under a sub-path only.** Under a sub-path, an external card to `/pricing` now leads to `/docs/pricing`. One written as `/docs/llms.txt` now leads to `/docs/docs/llms.txt`. A Markdown link already behaved this way. To link outside the portal, write a full URL. At the root of a domain nothing changes. ## Not covered - **Clicking a Markdown or header link to `/llms.txt`.** Its href is right, because the router adds the base. But the click navigates inside the app and shows the portal's own "Page Not Found" instead of the file, at the root as well. Reloading the page shows the file. It's filed as #487. - **Header links from `portal.navigation.links`** are not affected: the CLI marks only `http(s)://` addresses as external, so the rest go to the router. ## Checked - A copy of the `subpath` fixture with the default cards, built at `https://docs.test/p/abc123` and driven in headless Chrome: | Link | Before | After | | --- | --- | --- | | Agent-Friendly Docs card | `/llms.txt`, 404 | `/p/abc123/llms.txt`, 200, new tab | | SDKs card | `/p/abc123/sdks` | unchanged | | Same card, portal at the root | `/llms.txt`, 200 | unchanged | - `test/portal-template/base-path.test.ts` checks `underBase`. Root-relative addresses go under the base, `/docs/llms.txt` included, as the router reads it. Every other kind of address is left as written. - `test/portal-template/card.test.ts` (new) renders the real Card override under `/docs/`. An external card gets the path and still opens a new tab. A card not marked external goes to the router as written. - `test/helpers/template-render.ts` holds the Vite render setup that `card.test.ts`, `page-actions.test.ts` and `authorization-failure.test.ts` now share. - `test/e2e/portal-build.test.ts`: - The `subpath` fixture's figures page links two external cards, to `/api/llms.txt` and `/api/api/search.json`. The second address starts like the base and still goes under it. - The root build keeps `/llms.txt`. - A mocha run with every test file loaded, as CI loads them, filtered to the root and sub-path e2e and the template's tests: 78 passing, including the template's type check. I did not run the whole suite. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Muhammad Sohail <sohail.shahbaz@apimatic.io> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
sohail2721
requested review from
Shield-Jaguar and
saeedjamshaid
as code owners
November 30, 2026 05:57
|
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Promotes
devtobeta. This should publish 2.3.1-beta.1 to the npmbetadist-tag as a GitHub prerelease. The release run commits nothing back tobeta; the tag goes on this PR's merge commit.devalready contains main's 2.3.0 merge, so the version continues from v2.3.0.Merge with Create a merge commit.
What releases
Everything on
devsince 2.3.0: onefix, with nothing marked!, so a patch prerelease:Changes for users
This only affects a portal hosted under a sub-path: one whose
site.urlhas a path, or a preview at/p/<id>/.<Card>with a root-relativehrefnow goes under the path, as a Markdown link already does. The template's "Agent-Friendly Docs" card leads to/docs/llms.txtinstead of a 404 at/llms.txt./pricingleads to/docs/pricing. Link such an app with a full URL.A portal at the root of its domain renders exactly as before.
Before this beta goes to main
llms-full.txtbaseline in v4-test-automation and re-run the portal automation tests.devatbab883c9, this PR's head:llms-full.txt matches the baseline.new HttpClient { Timeout = Timeout.InfiniteTimeSpan }, and a new sentence on itsIHttpClientFactoryclient. The CLI doesn't produce that text.f52a60d2was a different case, the visual nav test TC-16c-2. It passed on the next run.[llms.txt](/llms.txt), shows "Page Not Found" when clicked, and the file after a reload.🤖 Generated with Claude Code