1 import { Option } from "@sniptt/monads";
2 import { htmlToText } from "html-to-text";
3 import { Component } from "inferno";
4 import { Helmet } from "inferno-helmet";
5 import { httpExternalPath } from "../../env";
6 import { md } from "../../utils";
8 interface HtmlTagsProps {
11 description: Option<string>;
12 image: Option<string>;
15 /// Taken from https://metatags.io/
16 export class HtmlTags extends Component<HtmlTagsProps, any> {
18 let url = httpExternalPath(this.props.path);
21 <Helmet title={this.props.title}>
22 {["title", "og:title", "twitter:title"].map(t => (
23 <meta key={t} property={t} content={this.props.title} />
25 {["og:url", "twitter:url"].map(u => (
26 <meta key={u} property={u} content={url} />
29 {/* Open Graph / Facebook */}
30 <meta property="og:type" content="website" />
33 <meta property="twitter:card" content="summary_large_image" />
35 {/* Optional desc and images */}
36 {this.props.description.isSome() &&
37 ["description", "og:description", "twitter:description"].map(n => (
42 md.renderInline(this.props.description.unwrap())
47 {this.props.image.isSome() &&
48 ["og:image", "twitter:image"].map(p => (
49 <meta key={p} property={p} content={this.props.image.unwrap()} />