+import { httpExternalPath } from "@utils/env";
import { htmlToText } from "html-to-text";
import { Component } from "inferno";
import { Helmet } from "inferno-helmet";
-import { httpExternalPath } from "../../env";
-import { i18n } from "../../i18next";
-import { md } from "../../utils";
+import { md } from "../../markdown";
+import { I18NextService } from "../../services";
interface HtmlTagsProps {
title: string;
path: string;
+ canonicalPath?: string;
description?: string;
image?: string;
}
export class HtmlTags extends Component<HtmlTagsProps, any> {
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 (
<Helmet title={this.props.title}>
- <html lang={i18n.resolvedLanguage} />
+ <html lang={I18NextService.i18n.resolvedLanguage} />
{["title", "og:title", "twitter:title"].map(t => (
<meta key={t} property={t} content={this.props.title} />
<meta key={u} property={u} content={url} />
))}
+ <link rel="canonical" href={canonicalUrl} />
+
{/* Open Graph / Facebook */}
<meta property="og:type" content="website" />