@@ -7,6 +7,7 @@ import {ClassAPI} from './ClassAPI';
77import { Code } from './Code' ;
88import { CodeBlock } from './CodeBlock' ;
99import { ExampleSwitcher } from './ExampleSwitcher' ;
10+ import { getLibraryFromPage , getLibraryLabel } from './library' ;
1011import { H2 , H3 , H4 } from './Headings' ;
1112import Header from './Header' ;
1213import { Link } from './Link' ;
@@ -46,18 +47,8 @@ function anchorId(children) {
4647 return children . replace ( / \s / g, '-' ) . replace ( / [ ^ a - z A - Z 0 - 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-
5950const 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
7869const 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