--- import { Separator } from 'ariakit/separator'; import type { MarkdownLayoutProps } from 'astro'; import { ExternalLink } from './ExternalLink.jsx'; import { Navbar } from './Navbar.jsx'; import { Outline } from './Outline.jsx'; import { PageButton } from './PageButton.jsx'; import { SidebarItems } from './SidebarItems.jsx'; import { generateGithubURL } from '~/util/url.js'; const pages = await Astro.glob<{ category: string; title: string }>('../pages/**/*.mdx'); type Props = MarkdownLayoutProps<{}>; const { headings, url, frontmatter } = Astro.props; const groupedPages = pages.reduce>((acc, page) => { const { category } = page.frontmatter; acc[category] ??= []; acc[category]?.push(page); return acc; }, {}); // @ts-expect-error props is not typed const category = frontmatter.category as string; const curCategoryPages = groupedPages[category]; const curCategoryIndex = curCategoryPages!.findIndex((page) => page.url === url); const pagePrev = curCategoryPages![curCategoryIndex - 1]; const pageNext = curCategoryPages![curCategoryIndex + 1]; ---
Test