(currentPage: Page)
| 114 | }; |
| 115 | |
| 116 | const getOgImageUrl = (currentPage: Page): string => { |
| 117 | let currentURL = new URL(currentPage.url); |
| 118 | let publicUrl = (process.env.PUBLIC_URL || '').replace(/\/$/, ''); |
| 119 | let path = currentURL.pathname || '/'; |
| 120 | if (path.endsWith('/')) { |
| 121 | path += 'index'; |
| 122 | } |
| 123 | return new URL(`${publicUrl}/og${path}.png`, currentURL).href; |
| 124 | }; |
| 125 | |
| 126 | const getDescription = (currentPage: Page): string => { |
| 127 | let library = getLibraryLabel(getLibraryFromPage(currentPage)); |