feat: add opengraph metadata
This commit is contained in:
parent
54ddf32e21
commit
2fc154f8a4
@ -6,6 +6,8 @@ node_modules
|
|||||||
.env
|
.env
|
||||||
.env.*
|
.env.*
|
||||||
!.env.example
|
!.env.example
|
||||||
|
/result
|
||||||
|
/.direnv
|
||||||
|
|
||||||
# Ignore files for PNPM, NPM and YARN
|
# Ignore files for PNPM, NPM and YARN
|
||||||
pnpm-lock.yaml
|
pnpm-lock.yaml
|
||||||
|
@ -78,6 +78,8 @@
|
|||||||
message: `Fetched ${count} tracks`,
|
message: `Fetched ${count} tracks`,
|
||||||
background: 'variant-filled-success'
|
background: 'variant-filled-success'
|
||||||
});
|
});
|
||||||
|
|
||||||
|
comm.close();
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
@ -13,6 +13,21 @@
|
|||||||
|
|
||||||
export let data;
|
export let data;
|
||||||
|
|
||||||
|
function getAlbumArtistInfo() {
|
||||||
|
const hasArtist = data.info.artist;
|
||||||
|
const hasAlbum = data.info.album;
|
||||||
|
|
||||||
|
if (hasArtist && hasAlbum) {
|
||||||
|
return `from ${data.info.album} by ${data.info.artist}`;
|
||||||
|
} else if (hasArtist) {
|
||||||
|
return `by ${data.info.artist}`;
|
||||||
|
} else if (hasAlbum) {
|
||||||
|
return `from ${data.info.album}`;
|
||||||
|
} else {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
let showIcon = false;
|
let showIcon = false;
|
||||||
let isError = false;
|
let isError = false;
|
||||||
|
|
||||||
@ -25,6 +40,10 @@
|
|||||||
|
|
||||||
<svelte:head>
|
<svelte:head>
|
||||||
<title>{data.info.title} {data.info.artist !== '' ? `- ${data.info.artist}` : ''}</title>
|
<title>{data.info.title} {data.info.artist !== '' ? `- ${data.info.artist}` : ''}</title>
|
||||||
|
<meta property="og:title" content={data.info.title} />
|
||||||
|
<meta property="og:description" content={getAlbumArtistInfo()} />
|
||||||
|
<meta property="og:image" content={data.thumbnail_url} />
|
||||||
|
<meta property="og:audio" content={data.audio_url} />
|
||||||
</svelte:head>
|
</svelte:head>
|
||||||
|
|
||||||
<div
|
<div
|
||||||
@ -40,6 +59,7 @@
|
|||||||
bind:paused
|
bind:paused
|
||||||
bind:currentTime
|
bind:currentTime
|
||||||
bind:duration
|
bind:duration
|
||||||
|
on:loadstart={(event) => event.currentTarget.play()}
|
||||||
/>
|
/>
|
||||||
<button
|
<button
|
||||||
class="relative rounded placeholder w-16 h-16"
|
class="relative rounded placeholder w-16 h-16"
|
||||||
|
Loading…
Reference in New Issue
Block a user