import { NextSeo } from "next-seo"; import { allOtherPages } from "contentlayer/generated"; export default function All({ pages }) { const labels = new Set(pages.map((p) => p.wikiPage.charAt(0))); return ( <>

A-Z Index

{Array.from(labels).map((pageTitle) => (

{pageTitle}


    {pages.map( ({ wikiPage, wikiPath }) => pageTitle === wikiPage.charAt(0) && (
  • {wikiPage}
  • ) )}
))}
); } export async function getStaticProps() { const pages = allOtherPages .map((page) => { const wikiPath = page._raw.flattenedPath; const wikiPage = wikiPath .split("/") .pop() .replace(/-/g, " ") .replace( /^(\w)(.+)/, (match, p1, p2) => p1.toUpperCase() + p2.toLowerCase() ); return { wikiPage, wikiPath }; }) .sort((a, b) => a.wikiPage.localeCompare(b.wikiPage)); return { props: { pages }, }; }