mirror of
https://github.com/jakejarvis/jarv.is.git
synced 2025-07-21 16:21:19 -04:00
fix <PageTitle />
canonical link
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
import { useRouter } from "next/router";
|
import { useRouter } from "next/router";
|
||||||
import Link from "next/link";
|
import Link from "next/link";
|
||||||
import classNames from "classnames";
|
import classNames from "classnames";
|
||||||
|
import { baseUrl } from "../../lib/config";
|
||||||
import type { ReactNode } from "react";
|
import type { ReactNode } from "react";
|
||||||
|
|
||||||
import styles from "./PageTitle.module.css";
|
import styles from "./PageTitle.module.css";
|
||||||
@@ -12,10 +13,11 @@ type Props = {
|
|||||||
|
|
||||||
const PageTitle = ({ children, className }: Props) => {
|
const PageTitle = ({ children, className }: Props) => {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
const canonical = `${baseUrl}${router.pathname}/`;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<h1 className={classNames(styles.title, className)}>
|
<h1 className={classNames(styles.title, className)}>
|
||||||
<Link href={router.asPath}>
|
<Link href={canonical}>
|
||||||
<a>{children}</a>
|
<a>{children}</a>
|
||||||
</Link>
|
</Link>
|
||||||
</h1>
|
</h1>
|
||||||
|
Reference in New Issue
Block a user