diff --git a/packages/gitbook/e2e/internal.spec.ts b/packages/gitbook/e2e/internal.spec.ts
index 002fb36ff..0db15e051 100644
--- a/packages/gitbook/e2e/internal.spec.ts
+++ b/packages/gitbook/e2e/internal.spec.ts
@@ -932,6 +932,22 @@ const testCases: TestsCase[] = [
},
]),
},
+ {
+ name: 'Page actions',
+ contentBaseURL: 'https://gitbook.gitbook.io/test-gitbook-open/',
+ tests: [
+ {
+ name: 'Without page actions',
+ url: getCustomizationURL({
+ pageActions: {
+ markdown: false,
+ externalAI: false,
+ },
+ }),
+ run: waitForCookiesDialog,
+ },
+ ],
+ },
{
name: 'Ads',
contentBaseURL: 'https://gitbook.gitbook.io/test-gitbook-open/',
diff --git a/packages/gitbook/src/components/AIActions/AIActionsDropdown.tsx b/packages/gitbook/src/components/AIActions/AIActionsDropdown.tsx
index d10d2abfe..a08afc091 100644
--- a/packages/gitbook/src/components/AIActions/AIActionsDropdown.tsx
+++ b/packages/gitbook/src/components/AIActions/AIActionsDropdown.tsx
@@ -8,6 +8,7 @@ import {
} from '@/components/AIActions/AIActions';
import { Button } from '@/components/primitives/Button';
import { DropdownMenu } from '@/components/primitives/DropdownMenu';
+import type { SiteCustomizationSettings } from '@gitbook/api';
import { Icon } from '@gitbook/icons';
import { useRef } from 'react';
@@ -16,10 +17,7 @@ interface AIActionsDropdownProps {
markdownPageUrl: string;
withAIChat?: boolean;
trademark: boolean;
- /**
- * Whether to include the "Open in LLM" entries in the dropdown menu.
- */
- withLLMActions?: boolean;
+ actions: SiteCustomizationSettings['pageActions'];
}
/**
@@ -59,7 +57,7 @@ export function AIActionsDropdown(props: AIActionsDropdownProps) {
* The content of the dropdown menu.
*/
function AIActionsDropdownMenuContent(props: AIActionsDropdownProps) {
- const { markdownPageUrl, withAIChat, trademark, withLLMActions } = props;
+ const { markdownPageUrl, withAIChat, trademark, actions } = props;
return (
<>
@@ -67,14 +65,18 @@ function AIActionsDropdownMenuContent(props: AIActionsDropdownProps) {
) : null}
-
-
+ {actions.markdown ? (
+ <>
+
+
+ >
+ ) : null}
- {withLLMActions ? (
+ {actions.externalAI ? (
<>
@@ -88,17 +90,27 @@ function AIActionsDropdownMenuContent(props: AIActionsDropdownProps) {
* A default action shown as a quick-access button beside the dropdown menu
*/
function DefaultAction(props: AIActionsDropdownProps) {
- const { markdownPageUrl, withAIChat, trademark } = props;
+ const { markdownPageUrl, withAIChat, trademark, actions } = props;
if (withAIChat) {
return ;
}
- return (
-
- );
+ if (actions.markdown) {
+ return (
+
+ );
+ }
+
+ if (actions.externalAI) {
+ return (
+ <>
+
+ >
+ );
+ }
}
diff --git a/packages/gitbook/src/components/PageBody/PageHeader.tsx b/packages/gitbook/src/components/PageBody/PageHeader.tsx
index b5e0f1bf3..4797f6b75 100644
--- a/packages/gitbook/src/components/PageBody/PageHeader.tsx
+++ b/packages/gitbook/src/components/PageBody/PageHeader.tsx
@@ -3,7 +3,7 @@ import { isAIChatEnabled } from '@/components/utils/isAIChatEnabled';
import type { GitBookSiteContext } from '@/lib/context';
import type { AncestorRevisionPage } from '@/lib/pages';
import { tcls } from '@/lib/tailwind';
-import { type RevisionPageDocument, SiteVisibility } from '@gitbook/api';
+import type { RevisionPageDocument } from '@gitbook/api';
import { Icon } from '@gitbook/icons';
import { PageIcon } from '../PageIcon';
import { StyledLink } from '../primitives';
@@ -22,6 +22,12 @@ export async function PageHeader(props: {
const withAIChat = isAIChatEnabled(context);
+ const pageActions = context.customization.pageActions ?? {
+ // TODO: After 25/07/2025, we can remove this default values as the cache will be updated
+ markdown: true,
+ externalAI: true,
+ };
+
return (
- {page.layout.tableOfContents ? (
+ {page.layout.tableOfContents &&
+ // Show page actions if *any* of the actions are enabled
+ (withAIChat || pageActions.markdown || pageActions.externalAI) ? (
) : null}