(currentPage: Page)
| 94 | }); |
| 95 | |
| 96 | const getTitle = (currentPage: Page): string => { |
| 97 | const explicitTitle = (currentPage as any).pageTitle || currentPage.exports?.pageTitle; |
| 98 | if ( |
| 99 | explicitTitle && |
| 100 | explicitTitle !== currentPage.tableOfContents?.[0]?.title && |
| 101 | explicitTitle !== currentPage.name |
| 102 | ) { |
| 103 | return explicitTitle as string; |
| 104 | } |
| 105 | |
| 106 | let library = getLibraryLabel(getLibraryFromPage(currentPage)); |
| 107 | const pageTitle = currentPage.tableOfContents?.[0]?.title ?? currentPage.name; |
| 108 | |
| 109 | if (currentPage.name === 'index.html' || currentPage.name.endsWith('/index.html')) { |
| 110 | return library || 'React Spectrum'; |
| 111 | } |
| 112 | |
| 113 | return library ? `${pageTitle} | ${library}` : pageTitle; |
| 114 | }; |
| 115 | |
| 116 | const getOgImageUrl = (currentPage: Page): string => { |
| 117 | let currentURL = new URL(currentPage.url); |
no test coverage detected