diff --git a/.changeset/page-actions-layout-visibility.md b/.changeset/page-actions-layout-visibility.md new file mode 100644 index 000000000..290332707 --- /dev/null +++ b/.changeset/page-actions-layout-visibility.md @@ -0,0 +1,5 @@ +--- +"gitbook": patch +--- + +Add support for hiding page actions from page layout options. diff --git a/packages/gitbook/src/components/PageBody/PageHeader.tsx b/packages/gitbook/src/components/PageBody/PageHeader.tsx index d2bfa5729..08177611a 100644 --- a/packages/gitbook/src/components/PageBody/PageHeader.tsx +++ b/packages/gitbook/src/components/PageBody/PageHeader.tsx @@ -27,13 +27,18 @@ export async function PageHeader(props: { const hasAncestors = ancestors.length > 0; + // @ts-expect-error available in next API update + const pageActionsEnabled = page.layout.actions !== false; + // Show page actions if *any* of the actions are enabled - const hasPageActions = [ - ...Object.values(context.customization.pageActions), - context.customization.pdf.enabled, - context.customization.git.showEditLink, - withRSSFeed, - ].some(Boolean); + const hasPageActions = + pageActionsEnabled && + [ + ...Object.values(context.customization.pageActions), + context.customization.pdf.enabled, + context.customization.git.showEditLink, + withRSSFeed, + ].some(Boolean); if (!page.layout.title && !page.layout.description && !hasPageActions) { return null;