diff --git a/app/components/organisms/Carousel.tsx b/app/components/organisms/Carousel.tsx index 6dc2964..ce85c21 100644 --- a/app/components/organisms/Carousel.tsx +++ b/app/components/organisms/Carousel.tsx @@ -4,6 +4,7 @@ interface CarouselItem { id: number; title: string; content: string; + slug: string; tags: string[]; notionPageId: string; } @@ -13,10 +14,9 @@ export const Carousel = ({ items }: { items: CarouselItem[] }) => {
{items.length > 0 ? (
- {items.map((item, index) => ( + {items.map((item) => ( diff --git a/app/routes/blog.$slug.tsx b/app/routes/blog.$slug.tsx index 975f423..34a02ee 100644 --- a/app/routes/blog.$slug.tsx +++ b/app/routes/blog.$slug.tsx @@ -1,5 +1,5 @@ import { defer, LoaderFunction, LoaderFunctionArgs } from "@remix-run/node"; -import { Await, useLoaderData } from "@remix-run/react"; +import { Await, useLoaderData, useParams } from "@remix-run/react"; import { NotionAPI } from "notion-client"; import React, { lazy, Suspense } from "react"; import { ClientOnly } from "remix-utils/client-only"; @@ -103,6 +103,8 @@ export const loader: LoaderFunction = async ({ export default function NotionRoute() { const { recordMap } = useLoaderData(); + const { slug } = useParams(); + const post = posts.find((p) => p.slug === slug); return (
@@ -117,9 +119,12 @@ export default function NotionRoute() { } > - {(resolvedRecordMap: ExtendedRecordMap) => ( - - )} + {(resolvedRecordMap: ExtendedRecordMap) => { + if (post) { + document.title = post.title; + } + return ; + }}