1 import { Option } from "@sniptt/monads";
2 import { Component } from "inferno";
3 import { Helmet } from "inferno-helmet";
4 import { httpExternalPath } from "../../env";
5 import { md } from "../../utils";
7 interface HtmlTagsProps {
10 description: Option<string>;
11 image: Option<string>;
14 /// Taken from https://metatags.io/
15 export class HtmlTags extends Component<HtmlTagsProps, any> {
17 let url = httpExternalPath(this.props.path);
20 <Helmet title={this.props.title}>
21 {["title", "og:title", "twitter:title"].map(t => (
22 <meta property={t} content={this.props.title} />
24 {["og:url", "twitter:url"].map(u => (
25 <meta property={u} content={url} />
28 {/* Open Graph / Facebook */}
29 <meta property="og:type" content="website" />
32 <meta property="twitter:card" content="summary_large_image" />
34 {/* Optional desc and images */}
35 {this.props.description.isSome() &&
36 ["description", "og:description", "twitter:description"].map(n => (
39 content={md.renderInline(this.props.description.unwrap())}
43 {this.props.image.isSome() &&
44 ["og:image", "twitter:image"].map(p => (
45 <meta property={p} content={this.props.image.unwrap()} />