1 import { htmlToText } from "html-to-text";
2 import { Component } from "inferno";
3 import { Helmet } from "inferno-helmet";
4 import { httpExternalPath } from "../../env";
5 import { i18n } from "../../i18next";
6 import { md } from "../../utils";
7 interface HtmlTagsProps {
14 /// Taken from https://metatags.io/
15 export class HtmlTags extends Component<HtmlTagsProps, any> {
17 const url = httpExternalPath(this.props.path);
18 const desc = this.props.description;
19 const image = this.props.image;
22 <Helmet title={this.props.title}>
23 <html lang={i18n.resolvedLanguage} />
25 {["title", "og:title", "twitter:title"].map(t => (
26 <meta key={t} property={t} content={this.props.title} />
28 {["og:url", "twitter:url"].map(u => (
29 <meta key={u} property={u} content={url} />
32 {/* Open Graph / Facebook */}
33 <meta property="og:type" content="website" />
36 <meta property="twitter:card" content="summary_large_image" />
38 {/* Optional desc and images */}
39 {["description", "og:description", "twitter:description"].map(
45 content={htmlToText(md.renderInline(desc))}
49 {["og:image", "twitter:image"].map(
50 p => image && <meta key={p} property={p} content={image} />