diff --git a/packages/docusaurus-utils/src/__tests__/urlUtils.test.ts b/packages/docusaurus-utils/src/__tests__/urlUtils.test.ts index fc9cf1662032..64c22ced0528 100644 --- a/packages/docusaurus-utils/src/__tests__/urlUtils.test.ts +++ b/packages/docusaurus-utils/src/__tests__/urlUtils.test.ts @@ -277,6 +277,15 @@ describe('toURLPath', () => { hash: '', }); }); + + it('pathname + hash containing a question mark (no query)', () => { + const url = parseURLOrPath('/pathname#hash?notQuery'); + expect(toURLPath(url)).toEqual({ + pathname: '/pathname', + search: undefined, + hash: 'hash?notQuery', + }); + }); }); describe('parseLocalURLPath', () => { diff --git a/packages/docusaurus-utils/src/urlUtils.ts b/packages/docusaurus-utils/src/urlUtils.ts index 52c2ec7445b4..0b661ce3d6cc 100644 --- a/packages/docusaurus-utils/src/urlUtils.ts +++ b/packages/docusaurus-utils/src/urlUtils.ts @@ -177,13 +177,17 @@ export type URLPath = {pathname: string; search?: string; hash?: string}; export function toURLPath(url: URL): URLPath { const {pathname} = url; + // Only the part before the fragment can contain the query string. A "?" + // inside the hash (e.g. "/foo#bar?baz") must not be read as an empty query. + const beforeHash = url.hash ? url.href.slice(0, -url.hash.length) : url.href; + // Fixes annoying url.search behavior // "" => undefined // "?" => "" // "?param => "param" const search = url.search ? url.search.slice(1) - : url.href.includes('?') + : beforeHash.includes('?') ? '' : undefined; diff --git a/website/community/2-resources.mdx b/website/community/2-resources.mdx index a4ff440eade0..42ef1f0747af 100644 --- a/website/community/2-resources.mdx +++ b/website/community/2-resources.mdx @@ -64,6 +64,7 @@ See the showcase - [expose-markdown-docusaurus-plugin](https://github.com/FlyNumber/markdown_docusaurus_plugin) - Exposes your /docs Markdown files as raw `.md` URLs (for LLM consumption). - [@agentreadyweb/docusaurus-plugin](https://github.com/AshutoshRaj97/agentready-mcp/tree/main/docusaurus-plugin) - Auto-indexes your docs in [AgentReady](https://www.agentready.it.com) after every build, making them instantly queryable by AI agents (Claude, Cursor, Windsurf) via MCP with cited answers. - [@deskcrew/docusaurus-plugin](https://github.com/webmilmind1/docusaurus-deskcrew) - Adds AI live chat, a help center and ticketing from [DeskCrew](https://deskcrew.io) to every docs page. Answers reader questions from your own help articles, and files a support ticket when it cannot. +- [Doc Bridge](https://github.com/AgentsKit-io/doc-bridge) - Indexes Docusaurus docs and sidebars into deterministic, package-scoped handoffs for coding agents, with freshness and coverage gates. ### Features {/* #features */}