import { createFileRoute } from "@tanstack/react-router"; import ReactMarkdown from "react-markdown"; import { getPost, formatDate } from "~/posts"; import { pageMeta } from "~/meta"; export const Route = createFileRoute("/blog/$")({ head: ({ params }) => { const slug = params._splat ?? ""; const path = `/blog/${slug}`; const post = getPost(slug); if (!post) return pageMeta("Not Found - Paseo", "Post not found.", path); return pageMeta(`${post.frontmatter.title} - Paseo`, post.frontmatter.description, path); }, component: BlogPost, }); const markdownComponents = { a: ({ href, children, ...props }: React.ComponentPropsWithoutRef<"a">) => { const isExternal = typeof href === "string" && /^https?:\/\//i.test(href); return ( {children} ); }, }; function BlogPost() { const { _splat } = Route.useParams(); const slug = _splat ?? ""; const post = getPost(slug); if (!post) { return

Post not found.

; } return (

{post.frontmatter.title}

Mo Boudra Mo Boudra ยท {formatDate(new Date(post.frontmatter.date))}
{post.content}
); }