Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions packages/docusaurus-utils/src/__tests__/urlUtils.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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', () => {
Expand Down
6 changes: 5 additions & 1 deletion packages/docusaurus-utils/src/urlUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
1 change: 1 addition & 0 deletions website/community/2-resources.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ See the <a href={require('@docusaurus/useBaseUrl').default('showcase')}>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 */}

Expand Down
Loading