Skip to content

Commit

Permalink
use ssr optimize seo
Browse files Browse the repository at this point in the history
  • Loading branch information
Moroshima committed Oct 12, 2023
1 parent db7921a commit 2bd8152
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 13 deletions.
1 change: 0 additions & 1 deletion src/components/heading.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ function Heading({ children, ...props }: any) {
const router = useRouter();
const postName = router.pathname.substring(1).split("/")[1];
const post = posts.find((item) => item.name === postName);
console.log(post);
return (
<>
<h1>{children}</h1>
Expand Down
3 changes: 1 addition & 2 deletions src/components/wrapper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,10 @@ function Wrapper(props: any) {
const router = useRouter();
const postName = router.pathname.substring(1).split("/")[1];
const post = posts.find((item) => item.name === postName);
console.log(post);
return (
<>
<Head>
<title>{post?.title} | Moroshima&apos;s Blog</title>
<title>{`${post?.title} | Moroshima's Blog`}</title>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="icon" href="/favicon.ico" />
</Head>
Expand Down
18 changes: 8 additions & 10 deletions src/pages/_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,12 @@ import { MDXProvider } from "@mdx-js/react";
import { useEffect, useState } from "react";
import { ChevronUpIcon, ThreeBarsIcon, XIcon } from "@primer/octicons-react";

const PreDynamicComponent = dynamic(() => import("../components/pre"), {
ssr: false,
});
const PreDynamicComponent = dynamic(() => import("../components/pre"));
const ImageDynamicComponent = dynamic(() => import("../components/image"), {
ssr: false,
});
const TableDynamicComponent = dynamic(() => import("../components/table"), {
ssr: false,
});
const WrapperDynamicComponent = dynamic(() => import("../components/wrapper"), {
ssr: false,
});
const TableDynamicComponent = dynamic(() => import("../components/table"));
const WrapperDynamicComponent = dynamic(() => import("../components/wrapper"));
const HeadingDynamicComponent = dynamic(() => import("../components/heading"));

const eb_garamond = EB_Garamond({ subsets: ["latin"], preload: true });
Expand Down Expand Up @@ -110,7 +104,11 @@ const components = {
if (children?.props?.src !== undefined) return <>{children}</>;
else return <p {...props}>{children}</p>;
},
blockquote: ({ children, ...props }: any) => (<blockquote className="blockquote" {...props}>{children}</blockquote>)
blockquote: ({ children, ...props }: any) => (
<blockquote className="blockquote" {...props}>
{children}
</blockquote>
),
};

export default function App({ Component, pageProps }: AppProps) {
Expand Down

0 comments on commit 2bd8152

Please sign in to comment.