feat: Add buildPublicUrl function and use it in config page image URL
This commit is contained in:
parent
6b02b4f4e7
commit
d49476236e
11
app/buildPublicUrl.ts
Normal file
11
app/buildPublicUrl.ts
Normal file
@ -0,0 +1,11 @@
|
||||
import { config } from "@/config";
|
||||
|
||||
export function buildPublicUrl(resource: string) {
|
||||
const { BASE_URL } = config;
|
||||
|
||||
if (BASE_URL) {
|
||||
return new URL(resource, BASE_URL).toString();
|
||||
}
|
||||
|
||||
return resource;
|
||||
}
|
||||
@ -1,5 +1,6 @@
|
||||
import type { Config } from "vike/types";
|
||||
|
||||
import { buildPublicUrl } from "@/buildPublicUrl";
|
||||
import Layout from "@/layouts/LayoutDefault";
|
||||
import vikeSolid from "vike-solid/config";
|
||||
|
||||
@ -25,7 +26,7 @@ export default {
|
||||
class: "flex min-h-full bg-white",
|
||||
},
|
||||
|
||||
image: "/opengraph/og.png",
|
||||
image: buildPublicUrl("/opengraph/og.png"),
|
||||
|
||||
prerender: true,
|
||||
prefetchStaticAssets: "hover",
|
||||
|
||||
Loading…
Reference in New Issue
Block a user