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 { md } from "../../utils";
7 interface HtmlTagsProps {
14 /// Taken from https://metatags.io/
15 export class HtmlTags extends Component<HtmlTagsProps, any> {
17 let url = httpExternalPath(this.props.path);
18 let desc = this.props.description;
19 let image = this.props.image;
22 <Helmet title={this.props.title}>
23 {["title", "og:title", "twitter:title"].map(t => (
24 <meta key={t} property={t} content={this.props.title} />
26 {["og:url", "twitter:url"].map(u => (
27 <meta key={u} property={u} content={url} />
30 {/* Open Graph / Facebook */}
31 <meta property="og:type" content="website" />
34 <meta property="twitter:card" content="summary_large_image" />
36 {/* Optional desc and images */}
37 {["description", "og:description", "twitter:description"].map(
43 content={htmlToText(md.renderInline(desc))}
47 {["og:image", "twitter:image"].map(
48 p => image && <meta key={p} property={p} content={image} />