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;
<meta key={u} property={u} content={url} />
))}
+ <link rel="canonical" href={canonicalUrl} />
+
{/* Open Graph / Facebook */}
<meta property="og:type" content="website" />
<HtmlTags
title={this.documentTitle}
path={this.context.router.route.match.url}
+ canonicalPath={res.community_view.community.actor_id}
description={res.community_view.community.description}
image={res.community_view.community.icon}
/>
<HtmlTags
title={this.documentTitle}
path={this.context.router.route.match.url}
+ canonicalPath={personRes.person_view.person.actor_id}
description={personRes.person_view.person.bio}
image={personRes.person_view.person.avatar}
/>
<HtmlTags
title={this.documentTitle}
path={this.context.router.route.match.url}
+ canonicalPath={res.post_view.post.ap_id}
image={this.imageTag}
description={res.post_view.post.body}
/>
<HtmlTags
title={this.documentTitle}
path={this.context.router.route.match.url}
+ canonicalPath={
+ this.context.router.route.match.url +
+ this.context.router.route.location.search
+ }
/>
<h1 className="h4 mb-4">{I18NextService.i18n.t("search")}</h1>
{this.selects}