diff --git a/.changeset/eight-eels-sort.md b/.changeset/eight-eels-sort.md
new file mode 100644
index 0000000000..ac16a4d95e
--- /dev/null
+++ b/.changeset/eight-eels-sort.md
@@ -0,0 +1,5 @@
+---
+"gitbook": patch
+---
+
+Fix markdownPageURL for PageActions
diff --git a/packages/gitbook/src/components/PageActions/PageActions.tsx b/packages/gitbook/src/components/PageActions/PageActions.tsx
index 09c7819df5..55b9b2c3db 100644
--- a/packages/gitbook/src/components/PageActions/PageActions.tsx
+++ b/packages/gitbook/src/components/PageActions/PageActions.tsx
@@ -171,6 +171,9 @@ export function ActionOpenInLLM(props: {
const providerLabel = provider === 'chatgpt' ? 'ChatGPT' : 'Claude';
+ // Remove the .md extension from the URL to avoid sending a bad request to the LLM.
+ const urlWithoutExtension = url.replace(/\.md$/, '');
+
return (
);
}
diff --git a/packages/gitbook/src/components/PageBody/PageHeader.tsx b/packages/gitbook/src/components/PageBody/PageHeader.tsx
index fd838d9e0f..e6d1c1c44f 100644
--- a/packages/gitbook/src/components/PageBody/PageHeader.tsx
+++ b/packages/gitbook/src/components/PageBody/PageHeader.tsx
@@ -40,7 +40,7 @@ export async function PageHeader(props: {
// Show page actions if *any* of the actions are enabled