import { httpExternalPath } from "@utils/env"; import { htmlToText } from "html-to-text"; import { Component } from "inferno"; import { Helmet } from "inferno-helmet"; import { md } from "../../markdown"; import { I18NextService } from "../../services"; interface HtmlTagsProps { title: string; path: string; canonicalPath?: string; description?: string; image?: string; } /// Taken from https://metatags.io/ export class HtmlTags extends Component { render() { const url = httpExternalPath(this.props.path); const canonicalUrl = this.props.canonicalPath ?? httpExternalPath(this.props.path); const desc = this.props.description; const image = this.props.image; return ( {["title", "og:title", "twitter:title"].map(t => ( ))} {["og:url", "twitter:url"].map(u => ( ))} {/* Open Graph / Facebook */} {/* Twitter */} {/* Optional desc and images */} {["description", "og:description", "twitter:description"].map( n => desc && ( ) )} {["og:image", "twitter:image"].map( p => image && )} ); } }