Skip to content

Commit 19c75bb

Browse files
committed
fix page title in Internationalized
1 parent 2f2e1cb commit 19c75bb

File tree

1 file changed

+3
-12
lines changed

1 file changed

+3
-12
lines changed

packages/dev/s2-docs/src/Layout.tsx

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import {ClassAPI} from './ClassAPI';
77
import {Code} from './Code';
88
import {CodeBlock} from './CodeBlock';
99
import {ExampleSwitcher} from './ExampleSwitcher';
10+
import {getLibraryFromPage, getLibraryLabel} from './library';
1011
import {H2, H3, H4} from './Headings';
1112
import Header from './Header';
1213
import {Link} from './Link';
@@ -46,18 +47,8 @@ function anchorId(children) {
4647
return children.replace(/\s/g, '-').replace(/[^a-zA-Z0-9-_]/g, '').toLowerCase();
4748
}
4849

49-
const getLibraryName = (currentPage: Page): string => {
50-
if (currentPage.name.startsWith('react-aria/')) {
51-
return 'React Aria';
52-
}
53-
if (currentPage.name.startsWith('internationalized/')) {
54-
return 'Internationalized';
55-
}
56-
return 'React Spectrum';
57-
};
58-
5950
const getTitle = (currentPage: Page): string => {
60-
let library = getLibraryName(currentPage);
51+
let library = getLibraryLabel(getLibraryFromPage(currentPage));
6152
const pageTitle = currentPage.exports?.title ?? currentPage.tableOfContents?.[0]?.title ?? currentPage.name;
6253
return library ? `${pageTitle} - ${library}` : pageTitle;
6354
};
@@ -76,7 +67,7 @@ const getOgImageUrl = (currentPage: Page): string => {
7667
};
7768

7869
const getDescription = (currentPage: Page): string => {
79-
let library = getLibraryName(currentPage);
70+
let library = getLibraryLabel(getLibraryFromPage(currentPage));
8071
const pageTitle = currentPage.exports?.title ?? currentPage.tableOfContents?.[0]?.title ?? currentPage.name;
8172
const explicitDescription = (currentPage as any).description || currentPage.exports?.description;
8273
if (explicitDescription) {

0 commit comments

Comments
 (0)