From 53c3cfeade90150b07431386745a24aa699a25ec Mon Sep 17 00:00:00 2001 From: Matthew Miner Date: Mon, 10 Jul 2023 09:46:36 -0500 Subject: [PATCH] Use canonical URLs (#1883) --- src/shared/components/common/html-tags.tsx | 5 +++++ src/shared/components/community/community.tsx | 1 + src/shared/components/person/profile.tsx | 1 + src/shared/components/post/post.tsx | 1 + src/shared/components/search.tsx | 4 ++++ 5 files changed, 12 insertions(+) diff --git a/src/shared/components/common/html-tags.tsx b/src/shared/components/common/html-tags.tsx index 5d53258..80649fa 100644 --- a/src/shared/components/common/html-tags.tsx +++ b/src/shared/components/common/html-tags.tsx @@ -8,6 +8,7 @@ import { I18NextService } from "../../services"; interface HtmlTagsProps { title: string; path: string; + canonicalPath?: string; description?: string; image?: string; } @@ -16,6 +17,8 @@ interface HtmlTagsProps { 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; @@ -30,6 +33,8 @@ export class HtmlTags extends Component { ))} + + {/* Open Graph / Facebook */} diff --git a/src/shared/components/community/community.tsx b/src/shared/components/community/community.tsx index c00380a..b88d6f6 100644 --- a/src/shared/components/community/community.tsx +++ b/src/shared/components/community/community.tsx @@ -312,6 +312,7 @@ export class Community extends Component< diff --git a/src/shared/components/person/profile.tsx b/src/shared/components/person/profile.tsx index 39979e2..d493f78 100644 --- a/src/shared/components/person/profile.tsx +++ b/src/shared/components/person/profile.tsx @@ -324,6 +324,7 @@ export class Profile extends Component< diff --git a/src/shared/components/post/post.tsx b/src/shared/components/post/post.tsx index f9d3512..eeb713a 100644 --- a/src/shared/components/post/post.tsx +++ b/src/shared/components/post/post.tsx @@ -353,6 +353,7 @@ export class Post extends Component { diff --git a/src/shared/components/search.tsx b/src/shared/components/search.tsx index e9aaaa1..99b1803 100644 --- a/src/shared/components/search.tsx +++ b/src/shared/components/search.tsx @@ -466,6 +466,10 @@ export class Search extends Component {

{I18NextService.i18n.t("search")}

{this.selects} -- 2.44.1