Skip to content

Commit

Permalink
fix(adapter-sveltekit): og meta null check
Browse files Browse the repository at this point in the history
  • Loading branch information
lihbr committed Jan 3, 2025
1 parent 71f0159 commit 9b8a490
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
14 changes: 7 additions & 7 deletions packages/adapter-sveltekit/src/hooks/project-init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -336,14 +336,14 @@ const createRootLayoutFile = async ({
</script>
<svelte:head>
<title>{$page.data.page?.meta_title}</title>
<meta property="og:title" content={$page.data.page?.meta_title} />
{#if isFilled.keyText($page.data.page?.meta_description)}
<meta name="description" content={$page.data.page.meta_description} />
<meta property="og:description" content={$page.data.page.meta_description} />
<title>{$page.data.page?.data.meta_title}</title>
<meta property="og:title" content={$page.data.page?.data.meta_title} />
{#if isFilled.keyText($page.data.page?.data.meta_description)}
<meta name="description" content={$page.data.page.data.meta_description} />
<meta property="og:description" content={$page.data.page.data.meta_description} />
{/if}
{#if isFilled.image($page.data.page?.meta_image)}
<meta property="og:image" content={asImageSrc($page.data.page.meta_image)} />
{#if isFilled.image($page.data.page?.data.meta_image)}
<meta property="og:image" content={asImageSrc($page.data.page.data.meta_image)} />
{/if}
</svelte:head>
<slot />
Expand Down
14 changes: 7 additions & 7 deletions packages/adapter-sveltekit/test/plugin-project-init.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1045,19 +1045,19 @@ describe("root layout file", () => {
</script>
<svelte:head>
<title>{$page.data.page?.meta_title}</title>
<meta property=\\"og:title\\" content={$page.data.page?.meta_title} />
{#if isFilled.keyText($page.data.page?.meta_description)}
<meta name=\\"description\\" content={$page.data.page.meta_description} />
<title>{$page.data.page?.data.meta_title}</title>
<meta property=\\"og:title\\" content={$page.data.page?.data.meta_title} />
{#if isFilled.keyText($page.data.page?.data.meta_description)}
<meta name=\\"description\\" content={$page.data.page.data.meta_description} />
<meta
property=\\"og:description\\"
content={$page.data.page.meta_description}
content={$page.data.page.data.meta_description}
/>
{/if}
{#if isFilled.image($page.data.page?.meta_image)}
{#if isFilled.image($page.data.page?.data.meta_image)}
<meta
property=\\"og:image\\"
content={asImageSrc($page.data.page.meta_image)}
content={asImageSrc($page.data.page.data.meta_image)}
/>
{/if}
</svelte:head>
Expand Down

0 comments on commit 9b8a490

Please sign in to comment.