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
5 changes: 5 additions & 0 deletions .changeset/eight-eels-sort.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"gitbook": patch
---

Fix markdownPageURL for PageActions
5 changes: 4 additions & 1 deletion packages/gitbook/src/components/PageActions/PageActions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -171,14 +171,17 @@ 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 (
<PageActionWrapper
type={type}
icon={provider}
label={tString(language, 'open_in', providerLabel)}
shortLabel={providerLabel}
description={tString(language, 'ai_chat_ask_about_page', providerLabel)}
href={getLLMURL(provider, url, language)}
href={getLLMURL(provider, urlWithoutExtension, language)}
/>
);
}
Expand Down
2 changes: 1 addition & 1 deletion packages/gitbook/src/components/PageBody/PageHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export async function PageHeader(props: {
// Show page actions if *any* of the actions are enabled
<PageActionsDropdown
siteTitle={context.site.title}
markdownPageURL={`${context.linker.toAbsoluteURL(context.linker.toPathInSpace(page.path))}`}
markdownPageURL={`${context.linker.toAbsoluteURL(context.linker.toPathInSpace(page.path))}.md`}
editOnGit={
context.customization.git.showEditLink &&
context.space.gitSync?.url &&
Expand Down