MCPcopy Create free account
hub / github.com/adobe/react-spectrum / getOgImageUrl

Function getOgImageUrl

packages/dev/s2-docs/src/Layout.tsx:116–124  ·  view source on GitHub ↗
(currentPage: Page)

Source from the content-addressed store, hash-verified

114};
115
116const 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
126const getDescription = (currentPage: Page): string => {
127 let library = getLibraryLabel(getLibraryFromPage(currentPage));

Callers 2

LayoutFunction · 0.85
ArticleFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected