Skip to content

Commit

Permalink
Try a local absolute path for the OG image, to see what happens
Browse files Browse the repository at this point in the history
  • Loading branch information
conradolandia committed Oct 3, 2024
1 parent d051d37 commit 2c47f07
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
9 changes: 8 additions & 1 deletion src/lib/blocks/Post.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand All @@ -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);
Expand All @@ -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);
</script>

<Metadata prism={true}/>
Expand Down
4 changes: 1 addition & 3 deletions svelte.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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()],
Expand Down
5 changes: 5 additions & 0 deletions vite.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
},
Expand Down

0 comments on commit 2c47f07

Please sign in to comment.