({ params }: CategoryPageProps)
| 18 | } |
| 19 | |
| 20 | export default async function CategoryPage({ params }: CategoryPageProps) { |
| 21 | const { category } = await params |
| 22 | const docs = getDocsByCategory(category) |
| 23 | |
| 24 | if (!docs.length) { |
| 25 | redirect('/docs') |
| 26 | } |
| 27 | |
| 28 | // Sort by order field and redirect to first doc |
| 29 | const sortedDocs = [...docs].sort((a, b) => (a.order ?? 0) - (b.order ?? 0)) |
| 30 | const firstDoc = sortedDocs[0] |
| 31 | |
| 32 | redirect(`/docs/${category}/${firstDoc.slug}`) |
| 33 | } |
nothing calls this directly
no test coverage detected