diff --git a/src/lib/blocks/Post.svelte b/src/lib/blocks/Post.svelte index 7500b8d2..1687b3f1 100644 --- a/src/lib/blocks/Post.svelte +++ b/src/lib/blocks/Post.svelte @@ -4,6 +4,7 @@ import { metadata } from "$lib/store"; import { title as siteTitle, ogSlug, blogSlug, ogImageBlog } from "$lib/config"; import { formattedPubDate, fetchAuthorMetadata } from "$lib/utils"; + import { base } from '$app/paths'; import Metadata from "$lib/components/Metadata.svelte"; @@ -22,7 +23,7 @@ let authorMetadata = { src: "", name: "" }; const slug = $page.url.pathname.replace(`/${blogSlug}`, '').replaceAll('/', ''); - const customOgImagePath = `${$page.url.origin}/assets/${ogSlug}/${slug}.png`; + const customOgImagePath = `${base}/assets/${ogSlug}/${slug}.png`; onMount(async () => { authorMetadata = await fetchAuthorMetadata(author); @@ -36,6 +37,12 @@ url: $page.url.href, image: customOgImagePath || ogImageBlog, }); + + // Debugging, remove later + console.log('Base:', base); + console.log('Slug:', slug); + console.log('Custom OG Image Path:', customOgImagePath); + console.log('Page URL:', $page.url.href); diff --git a/svelte.config.js b/svelte.config.js index 4df58da1..0fef082a 100644 --- a/svelte.config.js +++ b/svelte.config.js @@ -65,11 +65,9 @@ const config = { handleMissingId: "warn", entries: ["*"], }, - /* paths: { - base: process.env.NODE_ENV === "production" ? "/sveltekit-gh-pages" : "", + base: process.env.NODE_ENV === "production" ? "" : "", }, - */ }, extensions: [".svelte", ".md"], preprocess: [mdsvex(mdsvexOptions), vitePreprocess()], diff --git a/vite.config.js b/vite.config.js index faf8ccbd..57d7b715 100644 --- a/vite.config.js +++ b/vite.config.js @@ -5,6 +5,11 @@ import copyImages from "./scripts/vite-plugin-copy-images"; /** @type {import('vite').UserConfig} */ export default defineConfig({ plugins: [sveltekit(), copyImages()], + server: { + fs: { + allow: ['static'] + } + }, build: { sourcemap: false, },