1
mirror of https://github.com/jakejarvis/jarv.is.git synced 2025-10-28 20:55:47 -04:00

use safer method of concatenating absolute URLs

This commit is contained in:
2022-04-07 15:29:15 -04:00
parent 1d3727cca0
commit a8c1a3ba3c
9 changed files with 136 additions and 123 deletions

View File

@@ -2,6 +2,7 @@ import { useEffect } from "react";
import { useRouter } from "next/router";
import { DefaultSeo, SocialProfileJsonLd } from "next-seo";
import * as Fathom from "fathom-client";
import urlJoin from "url-join";
import { ThemeProvider } from "../contexts/ThemeContext";
import Layout from "../components/Layout";
import * as config from "../lib/config";
@@ -24,7 +25,7 @@ const App = ({ Component, pageProps }: AppProps) => {
// get this page's URL with full domain, and hack around query parameters and anchors
// NOTE: this assumes trailing slashes are enabled in next.config.js
const canonical = `${config.baseUrl}${router.pathname === "/" ? "" : router.pathname}/`;
const canonical = urlJoin(config.baseUrl, router.pathname === "/" ? "" : router.pathname, "/");
useEffect(() => {
// https://usefathom.com/docs/integrations/next