Skip to content

Commit

Permalink
Prefix og:image path with base URL
Browse files Browse the repository at this point in the history
  • Loading branch information
zeppelin committed Feb 15, 2024
1 parent a0b9d62 commit 2351f3f
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 1 deletion.
1 change: 1 addition & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
PUBLIC_BASE_URL=
2 changes: 2 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ jobs:
run: |
pnpm install
pnpm build
env:
PUBLIC_BASE_URL: https://svelte-promise-modals.com

- name: Deploy 🚀
uses: JamesIves/[email protected]
Expand Down
4 changes: 4 additions & 0 deletions src/app.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,8 @@ declare global {
}
}

declare module '$env/static/public' {
export const PUBLIC_BASE_URL: string | undefined;
}

export {};
5 changes: 4 additions & 1 deletion src/routes/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import dedent from 'dedent';
import { PUBLIC_BASE_URL } from '$env/static/public';
import ModalContainer from '$lib/ModalContainer.svelte';
import { openModal } from '$lib/service';
import type { ModalOptions } from '$lib/types';
Expand All @@ -17,6 +18,8 @@
import FooComponent from './FooComponent.svelte';
import SyntaxHighlight from './SyntaxHighlight.svelte';
let ogImageURL = PUBLIC_BASE_URL + ogimage;
async function openFooModal(data?: unknown, options?: ModalOptions) {
let result = await openModal(FooComponent, { data }, options);
console.log(`Modal result: ${JSON.stringify(result)}`);
Expand All @@ -30,7 +33,7 @@
<meta property="og:url" content="https://svelte-promise-modals.com/" />
<meta property="og:description" content="Modals in Svelte made easy." />
<meta property="og:type" content="website" />
<meta property="og:image" content={ogimage} />
<meta property="og:image" content={ogImageURL} />
<meta name="twitter:card" content="summary_large_image" />

<script
Expand Down

0 comments on commit 2351f3f

Please sign in to comment.