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 = {
|
||||
title: SITE_TITLE,
|
||||
description: SITE_DESCRIPTION,
|
||||
metadataBase: new URL(BASE_URL),
|
||||
...BASE_URL && { metadataBase: new URL(BASE_URL) },
|
||||
openGraph: {
|
||||
title: SITE_TITLE,
|
||||
description: SITE_DESCRIPTION,
|
||||
|
||||
@ -27,7 +27,7 @@ export const SITE_DESCRIPTION =
|
||||
SITE_DOMAIN;
|
||||
|
||||
export const BASE_URL = process.env.NODE_ENV === 'production'
|
||||
? makeUrlAbsolute(SITE_DOMAIN).toLowerCase()
|
||||
? makeUrlAbsolute(SITE_DOMAIN)?.toLowerCase()
|
||||
: 'http://localhost:3000';
|
||||
|
||||
// STORAGE: VERCEL BLOB
|
||||
|
||||
@ -6,7 +6,7 @@ export const shortenUrl = (url?: string) => url
|
||||
: undefined;
|
||||
|
||||
// Add protocol to url and remove trailing slash
|
||||
export const makeUrlAbsolute = (url = '') =>
|
||||
(!url.startsWith('http')
|
||||
? `https://${url}`
|
||||
: url).replace(/\/$/, '');
|
||||
export const makeUrlAbsolute = (url?: string) => url !== undefined
|
||||
? (!url.startsWith('http') ? `https://${url}` : url)
|
||||
.replace(/\/$/, '')
|
||||
: undefined;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user