Skip to content

Commit

Permalink
Remove www from canonical URLs
Browse files Browse the repository at this point in the history
  • Loading branch information
silvenon committed Aug 23, 2023
1 parent 5767ca8 commit f7db33a
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions app/components/CanonicalLink.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { useLocation } from "@remix-run/react";
import { useEffect } from "react";
import { removeTrailingSlash } from "~/utils";
import { removeWww, removeTrailingSlash } from "~/utils";
import { useAnalytics } from "~/services/analytics";

interface Props {
Expand All @@ -9,7 +9,9 @@ interface Props {

export default function CanonicalLink({ origin }: Props) {
const { pathname } = useLocation();
const canonicalUrl = removeTrailingSlash(new URL(pathname, origin).href);
const canonicalUrl = removeTrailingSlash(
removeWww(new URL(pathname, origin).href)
);
const analytics = useAnalytics();

useEffect(() => {
Expand Down

0 comments on commit f7db33a

Please sign in to comment.