Last active
July 18, 2022 11:45
-
-
Save wolfiex/e8938b74b83283a79e2e69d29edc3909 to your computer and use it in GitHub Desktop.
Svelte Sharable Content
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script> | |
import {onMount} from 'svelte'; | |
export let title = ''; | |
export let description = ''; | |
export let url = ''; | |
export let image = ''; | |
export let type = 'article'; | |
export let print = false; | |
onMount(() => { | |
if (print) console.warn(document.querySelector('share').innerHTML); | |
}); | |
</script> | |
<svelte:head> | |
<share> | |
<meta property="og:title" content={title} /> | |
<meta property="og:description" content={description} /> | |
<meta property="og:url" content={url} /> | |
<meta property="og:image" content={image} /> | |
<meta property="og:type" content={type} /> | |
<meta property="og:locale" content="en_GB" /> | |
</share> | |
</svelte:head> | |
<!-- A sharable metadata component by Dan Ellis 2022 --> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment