1
mirror of https://github.com/jakejarvis/jarv.is.git synced 2025-06-30 22:26:38 -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

@ -1,5 +1,6 @@
import { useRouter } from "next/router";
import NextLink from "next/link";
import urlJoin from "url-join";
import { styled } from "../../lib/styles/stitches.config";
import { baseUrl } from "../../lib/config";
import type { ComponentProps } from "react";
@ -24,7 +25,7 @@ export type PageTitleProps = ComponentProps<typeof Title>;
const PageTitle = ({ children, ...rest }: PageTitleProps) => {
const router = useRouter();
const canonical = `${baseUrl}${router.pathname}/`;
const canonical = urlJoin(baseUrl, router.pathname, "/");
return (
<Title {...rest}>