diff --git a/src/lib/meta/index.tsx b/src/lib/meta/index.tsx
deleted file mode 100644
index 280ffaa..0000000
--- a/src/lib/meta/index.tsx
+++ /dev/null
@@ -1,49 +0,0 @@
-import Head from "next/head"
-import { useRouter } from "next/router"
-
-type Props = {
- title: string
- ogType: "website" | "article"
- description?: string
-}
-
-export const Meta = (props: Props) => {
- // const og = `https://og-image-eta-sable.vercel.app/${encodeURIComponent(
- // props.title
- // )}`
-
- const og = "https://www.mrskiro.dev/assets/mrskiro.png"
-
- const router = useRouter()
- const url = `https://mrskiro.dev${router.asPath}`
-
- /* TODO: envに移動 */
- const title = `${props.title} | mrskiro.dev`
- return (
-
-
-
-
- {title}
-
- {props.description && (
-
- )}
-
-
-
-
-
-
-
-
-
-
-
-
-
- )
-}
diff --git a/src/pages/404/index.tsx b/src/pages/404/index.tsx
index 6c38b60..cb6832e 100644
--- a/src/pages/404/index.tsx
+++ b/src/pages/404/index.tsx
@@ -1,11 +1,16 @@
import { NextPage } from "next"
import { NotFoundPage } from "@/components/pages/404"
-import { Meta } from "@/lib/meta"
-const Page: NextPage = () => (
- <>
-
-
- >
-)
+export const getStaticProps = async () => {
+ return {
+ props: {
+ meta: {
+ title: "404",
+ ogType: "website",
+ },
+ },
+ }
+}
+
+const Page: NextPage = () =>
export default Page
diff --git a/src/pages/_app.tsx b/src/pages/_app.tsx
index 47283e6..aee1af8 100644
--- a/src/pages/_app.tsx
+++ b/src/pages/_app.tsx
@@ -1,4 +1,6 @@
import * as React from "react"
+import Head from "next/head"
+import { useRouter } from "next/router"
import { ErrorBoundary } from "@/components/error-boundary"
import { ThemeProvider } from "@/features/theme/context"
import { TwoColumn } from "@/layouts/two-column"
@@ -7,11 +9,43 @@ import { GoogleAnalytics, usePegeView } from "@/lib/log"
import { ResetStyle } from "@/lib/style/reset-style"
import type { AppProps } from "next/app"
-const MyApp = (props: AppProps) => {
+const MyApp = (
+ props: AppProps<{
+ meta?: {
+ title?: string
+ ogType?: "website" | "article"
+ }
+ }>
+) => {
usePegeView()
+ const { meta } = props.pageProps
+
+ const router = useRouter()
+ const url = `https://mrskiro.dev${router.asPath}`
return (
<>
+
+
+
+
+
+ {meta?.title ? `${meta.title} | mrskiro.dev` : "mrskiro.dev"}
+
+
+
+
+
+
+
+
+
{isPrd() && }
{/* eslint-disable-next-line @typescript-eslint/ban-ts-comment */}
{/* @ts-ignore */}
diff --git a/src/pages/about/index.tsx b/src/pages/about/index.tsx
index f7b90ab..b95ae2d 100644
--- a/src/pages/about/index.tsx
+++ b/src/pages/about/index.tsx
@@ -4,7 +4,6 @@ import { AboutPage } from "@/components/pages/about"
import { findPostDetailById } from "@/features/post/api"
import * as PostTypes from "@/features/post/types"
import { load } from "@/lib/config"
-import { Meta } from "@/lib/meta"
type Props = {
aboutPageDetail: PostTypes.PostDetail
@@ -16,6 +15,10 @@ export const getStaticProps: GetStaticProps = async () => {
return {
props: {
aboutPageDetail,
+ meta: {
+ title: "About",
+ ogType: "article",
+ },
},
}
}
@@ -26,16 +29,7 @@ const Page: NextPage = (props) => {
return loading...
}
- return (
- <>
-
-
- >
- )
+ return
}
export default Page
diff --git a/src/pages/index.tsx b/src/pages/index.tsx
index 9a61738..5c4092c 100644
--- a/src/pages/index.tsx
+++ b/src/pages/index.tsx
@@ -3,7 +3,6 @@ import { RootPage } from "@/components/pages/root/root"
import { findPosts } from "@/features/post/api"
import { Post } from "@/features/post/types/post"
import { load } from "@/lib/config"
-import { Meta } from "@/lib/meta"
import { parseByURL } from "@/lib/parser/rss"
type Props = {
@@ -36,19 +35,14 @@ export const getStaticProps: GetStaticProps = async () => {
return {
props: {
posts,
+ meta: {
+ title: "Posts",
+ ogType: "website",
+ },
},
}
}
-const Page: NextPage = (props) => (
- <>
-
-
- >
-)
+const Page: NextPage = (props) =>
export default Page
diff --git a/src/pages/posts/[param]/index.tsx b/src/pages/posts/[param]/index.tsx
index 52407db..b1efff0 100644
--- a/src/pages/posts/[param]/index.tsx
+++ b/src/pages/posts/[param]/index.tsx
@@ -4,7 +4,6 @@ import { PostDetailPage } from "@/components/pages/posts/[param]"
import { findPostDetailBySlug, findPosts } from "@/features/post/api"
import * as PostTypes from "@/features/post/types"
import { toPublic } from "@/lib/image"
-import { Meta } from "@/lib/meta"
export const getStaticPaths: GetStaticPaths = async () => {
const posts = await findPosts()
@@ -43,6 +42,10 @@ export const getStaticProps: GetStaticProps = async (
return {
props: {
postDetail,
+ meta: {
+ title: postDetail.title.plainText,
+ ogType: "article",
+ },
},
}
}
@@ -53,12 +56,7 @@ const Page: NextPage = (props) => {
return loading...
}
- return (
- <>
-
-
- >
- )
+ return
}
export default Page