Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 | 19x 19x 19x 19x 232x 232x | import { useTranslation } from "i18n";
import { GLOBAL } from "i18n/namespaces";
import Head from "next/head";
const HTML_META_DEFAULT_SHARE_IMAGE = "https://couchers.org/img/share.jpg";
interface HtmlMetaProps {
title?: string;
sharingTitle?: string;
description?: string;
shareImage?: string;
noSuffix?: boolean;
}
export default function HtmlMeta({
title,
sharingTitle,
description,
shareImage = HTML_META_DEFAULT_SHARE_IMAGE,
noSuffix,
}: HtmlMetaProps) {
const { t } = useTranslation(GLOBAL);
return (
<Head>
<title>
{!title
? t("html_meta.default_title")
: noSuffix
? title
: `${title}${t("html_meta.title_suffix")}`}
</title>
<meta
key="title"
name="title"
content={
!sharingTitle
? t("html_meta.default_title")
: noSuffix
? sharingTitle
: `${sharingTitle}${t("html_meta.title_suffix")}`
}
/>
<meta
key="og_title"
property="og:title"
content={
!sharingTitle
? t("html_meta.default_title")
: noSuffix
? sharingTitle
: `${sharingTitle}${t("html_meta.title_suffix")}`
}
/>
<meta
key="twitter_title"
name="twitter:title"
content={
!sharingTitle
? t("html_meta.default_title")
: noSuffix
? sharingTitle
: `${sharingTitle}${t("html_meta.title_suffix")}`
}
/>
<meta
key="description"
name="description"
content={description ?? t("html_meta.default_description")}
/>
<meta
key="og_description"
property="og:description"
content={description ?? t("html_meta.default_description")}
/>
<meta
key="twitter_description"
name="twitter:description"
content={description ?? t("html_meta.default_description")}
/>
<meta key="og_image" property="og:image" content={shareImage} />
<meta key="twitter_image" property="twitter:image" content={shareImage} />
<meta
name="viewport"
content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"
/>
</Head>
);
}
|