Files
supabase/apps/docs/internals/files/reference-lib.ts
T
Charis c757fcab20 fix,feat(sitemap): add all pages + priority (#29083)
Pages were missing from the sitemap after the reorganization. Added them
back in.

Also added an optional priority that can be specified by including
`sitemapPriority` in content metadata. Used on the deprecated Auth
Helpers pages to see if we can tweak the relative SEO ranking for them.
2024-09-04 11:16:51 -04:00

31 lines
1.0 KiB
TypeScript

import { REFERENCES } from '../../content/navigation.references'
import { getFlattenedSections } from '../../features/docs/Reference.generated.singleton'
export async function generateReferencePages() {
return (
await Promise.all(
Object.keys(REFERENCES)
.flatMap((key) => {
return REFERENCES[key].versions.map((version) => {
return {
sdkId: key,
version: version,
isLatestVersion: version === REFERENCES[key].versions[0],
libPath: REFERENCES[key].libPath,
}
})
})
.map(async ({ sdkId, version, libPath, isLatestVersion }) => {
const flattenedSections = await getFlattenedSections(sdkId, version)
return (
flattenedSections?.map((section) => ({
link: isLatestVersion
? `reference/${libPath}/${section.slug}`
: `reference/${libPath}/${version}/${section.slug}`,
})) ?? []
)
})
)
).flat()
}