mirror of
https://github.com/lukevella/rallly.git
synced 2025-06-04 03:32:12 +02:00
🪛 Clean up and fix og-image code (#820)
This commit is contained in:
parent
e7a69ffe1d
commit
6ff907004c
4 changed files with 22 additions and 25 deletions
|
@ -15,13 +15,18 @@ function joinPath(baseUrl: string, subpath = "") {
|
|||
return baseUrl;
|
||||
}
|
||||
|
||||
export function absoluteUrl(subpath = "") {
|
||||
export function absoluteUrl(subpath = "", query?: Record<string, string>) {
|
||||
const queryString = query
|
||||
? `?${Object.entries(query)
|
||||
.map(([key, value]) => `${key}=${encodeURIComponent(value)}`)
|
||||
.join("&")}`
|
||||
: "";
|
||||
const baseUrl =
|
||||
process.env.NEXT_PUBLIC_BASE_URL ??
|
||||
getVercelUrl() ??
|
||||
`http://localhost:${port}`;
|
||||
|
||||
return joinPath(baseUrl, subpath);
|
||||
return joinPath(baseUrl, subpath) + queryString;
|
||||
}
|
||||
|
||||
export function shortUrl(subpath = "") {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue