MCPcopy Index your code
hub / github.com/CodebuffAI/codebuff / CategoryPage

Function CategoryPage

web/src/app/docs/[category]/page.tsx:20–33  ·  view source on GitHub ↗
({ params }: CategoryPageProps)

Source from the content-addressed store, hash-verified

18}
19
20export 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}

Callers

nothing calls this directly

Calls 2

getDocsByCategoryFunction · 0.90
redirectFunction · 0.50

Tested by

no test coverage detected