diff --git a/.changeset/ready-parrots-travel.md b/.changeset/ready-parrots-travel.md new file mode 100644 index 0000000000..e3c772721d --- /dev/null +++ b/.changeset/ready-parrots-travel.md @@ -0,0 +1,5 @@ +--- +"gitbook": patch +--- + +Fix icon resolution for page group diff --git a/packages/gitbook/src/lib/references.tsx b/packages/gitbook/src/lib/references.tsx index 917ce95613..0d44319d64 100644 --- a/packages/gitbook/src/lib/references.tsx +++ b/packages/gitbook/src/lib/references.tsx @@ -177,14 +177,15 @@ export async function resolveContentRef( } } else { const parentPage = (resolvePageResult?.ancestors || []).slice(-1).pop(); - // When the looked up ref was a page group we use the page group title as resolved ref text. - // Otherwise use the resolved page title. - text = + // When the looked up ref was a page group we use the page group to resolve title and icon. + // Otherwise use the resolved page title and icon. + const pageOrGroup = parentPage && contentRef.page === parentPage.id && parentPage.type === 'group' - ? parentPage.title - : page.title; + ? parentPage + : page; + text = pageOrGroup.title; emoji = isCurrentPage ? undefined : page.emoji; - icon = ; + icon = ; } return {