Skip to content

Commit

Permalink
drop search query for canonical url so google won't get confused
Browse files Browse the repository at this point in the history
  • Loading branch information
xHomu committed Oct 23, 2024
1 parent bb6fee2 commit 93f8480
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion app/root.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import {
Outlet,
Scripts,
useLoaderData,
useLocation,
useNavigation,
} from "@remix-run/react";
import splideCSS from "@splidejs/splide/dist/css/splide-core.min.css";
Expand Down Expand Up @@ -90,6 +91,7 @@ export const loader = async ({
user,
siteSlug,
following,
origin: new URL(request.url).origin,
},
{ headers },
);
Expand Down Expand Up @@ -182,10 +184,11 @@ function ProgressBar() {
}

function App() {
const { locale, toast } = useLoaderData<typeof loader>();
const { locale, toast, origin } = useLoaderData<typeof loader>();
const { i18n } = useTranslation();
const isBot = useIsBot();
const theme = useTheme();
const location = useLocation();

useChangeLanguage(locale);
const { site } = useSiteLoaderData();
Expand Down Expand Up @@ -256,6 +259,11 @@ function App() {
href="/favicon.ico"
/>
)}
<link
//drop search query for canonical url so google won't get confused
rel="canonical"
href={origin + location.pathname}
/>
<Meta />
<Links />
</head>
Expand Down

0 comments on commit 93f8480

Please sign in to comment.