import { For, Show } from "solid-js"; import type { RouteSectionProps } from "@solidjs/router"; import { Meta, Title } from "@solidjs/meta"; import { posts } from "~/data/posts"; //@ts-expect-error import { MDXProvider } from "solid-mdx"; import { markdownComponents, PostImage } from "~/components/Markdown"; import dayjs from "dayjs"; import "../css/prism-nord.css"; import type { Post } from "~/types"; /* * Code from andii.dev */ const Blog = (props: RouteSectionProps) => { const meta = () => posts.find((p) => props.location.pathname.endsWith(p.slug)) as Post; const index = () => posts.indexOf(meta()); const prevMeta = () => index() === posts.length - 1 ? undefined : posts[index() + 1]; const nextMeta = () => (index() === 0 ? undefined : posts[index() - 1]); return (
minhtran_dev - {meta()?.title}

{meta().title}

{dayjs(meta().date).format("D MMMM YYYY")}

{(tag, index) => ( <> {tag} {index() === meta().tags.length - 1 ? "" : ", "} )}
{props.children}
); }; export default Blog;