Make app more resilient to missing vercel project meta
This commit is contained in:
parent
c3fd40efa9
commit
7b6b819328
@ -21,7 +21,7 @@ const ibmPlexMono = IBM_Plex_Mono({
|
|||||||
export const metadata: Metadata = {
|
export const metadata: Metadata = {
|
||||||
title: SITE_TITLE,
|
title: SITE_TITLE,
|
||||||
description: SITE_DESCRIPTION,
|
description: SITE_DESCRIPTION,
|
||||||
metadataBase: new URL(BASE_URL),
|
...BASE_URL && { metadataBase: new URL(BASE_URL) },
|
||||||
openGraph: {
|
openGraph: {
|
||||||
title: SITE_TITLE,
|
title: SITE_TITLE,
|
||||||
description: SITE_DESCRIPTION,
|
description: SITE_DESCRIPTION,
|
||||||
|
|||||||
@ -27,7 +27,7 @@ export const SITE_DESCRIPTION =
|
|||||||
SITE_DOMAIN;
|
SITE_DOMAIN;
|
||||||
|
|
||||||
export const BASE_URL = process.env.NODE_ENV === 'production'
|
export const BASE_URL = process.env.NODE_ENV === 'production'
|
||||||
? makeUrlAbsolute(SITE_DOMAIN).toLowerCase()
|
? makeUrlAbsolute(SITE_DOMAIN)?.toLowerCase()
|
||||||
: 'http://localhost:3000';
|
: 'http://localhost:3000';
|
||||||
|
|
||||||
// STORAGE: VERCEL BLOB
|
// STORAGE: VERCEL BLOB
|
||||||
|
|||||||
@ -6,7 +6,7 @@ export const shortenUrl = (url?: string) => url
|
|||||||
: undefined;
|
: undefined;
|
||||||
|
|
||||||
// Add protocol to url and remove trailing slash
|
// Add protocol to url and remove trailing slash
|
||||||
export const makeUrlAbsolute = (url = '') =>
|
export const makeUrlAbsolute = (url?: string) => url !== undefined
|
||||||
(!url.startsWith('http')
|
? (!url.startsWith('http') ? `https://${url}` : url)
|
||||||
? `https://${url}`
|
.replace(/\/$/, '')
|
||||||
: url).replace(/\/$/, '');
|
: undefined;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user