Skip to content

Commit 8f0b979

Browse files
authored
Support new "link title" page option (#3798)
1 parent d460dc4 commit 8f0b979

File tree

4 files changed

+8
-9
lines changed

4 files changed

+8
-9
lines changed

bun.lock

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
{
22
"lockfileVersion": 1,
3-
"configVersion": 0,
43
"workspaces": {
54
"": {
65
"name": "gitbook",
@@ -346,7 +345,7 @@
346345
"react-dom": "catalog:",
347346
},
348347
"catalog": {
349-
"@gitbook/api": "0.151.0",
348+
"@gitbook/api": "0.153.0",
350349
"@scalar/api-client-react": "^1.3.46",
351350
"@tsconfig/node20": "^20.1.6",
352351
"@tsconfig/strictest": "^2.0.6",
@@ -727,7 +726,7 @@
727726

728727
"@fortawesome/fontawesome-svg-core": ["@fortawesome/fontawesome-svg-core@6.6.0", "", { "dependencies": { "@fortawesome/fontawesome-common-types": "6.6.0" } }, "sha512-KHwPkCk6oRT4HADE7smhfsKudt9N/9lm6EJ5BVg0tD1yPA5hht837fB87F8pn15D8JfTqQOjhKTktwmLMiD7Kg=="],
729728

730-
"@gitbook/api": ["@gitbook/api@0.151.0", "", { "dependencies": { "event-iterator": "^2.0.0", "eventsource-parser": "^3.0.0" } }, "sha512-5d9+rZ2u6CKKIiVHO1Toyk+7wHtTOXmP0+sVIE3teRkceX4z5FGIIpa4XsFeKC9XeosncvehdshPaOGQtSDpTQ=="],
729+
"@gitbook/api": ["@gitbook/api@0.153.0", "", { "dependencies": { "event-iterator": "^2.0.0", "eventsource-parser": "^3.0.0" } }, "sha512-ArNPFoqwId4Flicz8xPEdGqXQkzxyxP7S8Uv3wIfCX2e4cLhpcS7xCJGEHOJrqe1tNs1ovT1N2MWfpdIqzXqig=="],
731730

732731
"@gitbook/browser-types": ["@gitbook/browser-types@workspace:packages/browser-types"],
733732

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
"catalog": {
4242
"@tsconfig/strictest": "^2.0.6",
4343
"@tsconfig/node20": "^20.1.6",
44-
"@gitbook/api": "0.151.0",
44+
"@gitbook/api": "0.153.0",
4545
"@scalar/api-client-react": "^1.3.46",
4646
"@types/react": "^19.0.0",
4747
"@types/react-dom": "^19.0.0",

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.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: 4 additions & 4 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.title,
132+
label: ancestor.linkTitle ?? ancestor.title,
133133
icon:
134134
ancestor.emoji || ancestor.icon ? (
135135
<PageIcon
@@ -153,9 +153,9 @@ export async function resolveContentRef(
153153

154154
// Compute the text to display for the link
155155
if (anchor) {
156-
text = page.title;
156+
text = page.linkTitle || page.title;
157157
ancestors.push({
158-
label: page.title,
158+
label: page.linkTitle || page.title,
159159
icon: <PageIcon page={page} style={iconStyle} />,
160160
href,
161161
});
@@ -177,7 +177,7 @@ export async function resolveContentRef(
177177
parentPage && contentRef.page === parentPage.id && parentPage.type === 'group'
178178
? parentPage
179179
: page;
180-
text = 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)