Add page actions layout visibility (#4270)

This commit is contained in:
Greg Bergé
2026-05-22 12:37:37 +02:00
committed by GitHub
parent 287203d197
commit 3697dfefed
2 changed files with 16 additions and 6 deletions
@@ -0,0 +1,5 @@
---
"gitbook": patch
---
Add support for hiding page actions from page layout options.
@@ -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;