front/BaseTemplate: add facebook, twitter and generic url preview meta tags

This commit is contained in:
Alice Gaudon 2021-12-03 00:40:31 +01:00
parent 689c860e2e
commit 32a1721ef2

View File

@ -3,10 +3,12 @@
import BaseFooter from "./base/BaseFooter.svelte"; import BaseFooter from "./base/BaseFooter.svelte";
import BaseHeader from "./base/BaseHeader.svelte"; import BaseHeader from "./base/BaseHeader.svelte";
import CommonScripts from "./CommonScripts.svelte"; import CommonScripts from "./CommonScripts.svelte";
import {locals} from '../../ts/stores.js';
export let title: string; export let title: string;
export let h1: string = title; export let h1: string = title;
export let description: string; export let description: string;
export let previewImageUrl: string | undefined = undefined;
export let refresh_after: number | undefined = undefined; export let refresh_after: number | undefined = undefined;
export let noHeader: boolean = false; export let noHeader: boolean = false;
export let noH1: boolean = false; export let noH1: boolean = false;
@ -37,8 +39,22 @@
<meta name="viewport" content="width=device-width,initial-scale=1.0"> <meta name="viewport" content="width=device-width,initial-scale=1.0">
<title>{title || 'Undefined title'}</title> <title>{title || 'Undefined title'}</title>
<!-- Open Graph / Facebook -->
<meta property="og:type" content="website">
<meta property="og:title" content={title}>
<meta property="og:url" content="{$locals.app.public_url + $locals.url}">
<meta property="twitter:title" content={title}>
<meta property="twitter:url" content={$locals.app.public_url + $locals.url}>
{#if description} {#if description}
<meta name="description" content={description}> <meta name="description" content={description}>
<meta property="og:description" content={description}>
<meta property="twitter:description" content={description}>
{/if}
{#if previewImageUrl}
<meta property="og:image" content={previewImageUrl}>
<meta property="twitter:card" content="summary_large_image">
<meta property="twitter:image" content={previewImageUrl}>
{/if} {/if}
<link rel="shortcut icon" type="image/png" href="/img/logox1024.png"> <link rel="shortcut icon" type="image/png" href="/img/logox1024.png">