Skip to content

Commit b77623b

Browse files
authored
Fix link title fallback in ToC item (#3845)
1 parent 1430cee commit b77623b

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

packages/gitbook/src/components/TableOfContents/encodeClientTableOfContents.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ export async function encodeClientTableOfContents(
7272
result.push(
7373
removeUndefined({
7474
id: page.id,
75-
title: page.linkTitle ?? page.title,
75+
title: page.linkTitle || page.title,
7676
href,
7777
emoji: page.emoji,
7878
icon: page.icon,

packages/gitbook/src/lib/references.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ export async function resolveContentRef(
129129
const page = resolvePageResult?.page;
130130
const ancestors =
131131
resolvePageResult?.ancestors.map((ancestor) => ({
132-
label: ancestor.linkTitle ?? ancestor.title,
132+
label: ancestor.linkTitle || ancestor.title,
133133
icon:
134134
ancestor.emoji || ancestor.icon ? (
135135
<PageIcon
@@ -177,7 +177,7 @@ export async function resolveContentRef(
177177
parentPage && contentRef.page === parentPage.id && parentPage.type === 'group'
178178
? parentPage
179179
: page;
180-
text = pageOrGroup.linkTitle ?? pageOrGroup.title;
180+
text = pageOrGroup.linkTitle || pageOrGroup.title;
181181
emoji = isCurrentPage ? undefined : page.emoji;
182182
icon = <PageIcon page={pageOrGroup} style={iconStyle} />;
183183
}

0 commit comments

Comments
 (0)