diff --git a/src/pages/developers/courses/index.tsx b/src/pages/developers/courses/index.tsx index a372a10d0..ee6ccdf96 100644 --- a/src/pages/developers/courses/index.tsx +++ b/src/pages/developers/courses/index.tsx @@ -35,36 +35,44 @@ export async function getStaticProps({ locale }) { } export default function DeveloperCoursesIndex({ - // todo: featured, - records, + records: courseRecords, }: InferGetStaticPropsType) { const { t } = useTranslation("common"); - // Sort the course records by their priority - // Eg, 'intro' courses should be listed first before more advanced topics. - records.sort((a, b) => a.priority - b.priority); - const results: DefaultCard[] = records.map((record) => { - return { - type: "blog", - eyebrow: record.lessons.length > 0 && `${record.lessons.length} Lessons`, - // publishedDate?: string; - // heading: record.title, - // headingAs?: ElementType; - body: record.description, - callToAction: { - hierarchy: "link", - size: "md", - label: "Start Course", - endIcon: "arrow-up-right", - iconSize: "sm", - url: record.href, - }, - backgroundImage: { - src: record.image || `/opengraph/developers/courses/${record.slug}`, - }, - isFeatured: false, - }; - }); + let filteredCourseRecords = courseRecords + // Remove any courses with the isHidden flag + // Note: we don't remove the routing to them as there's currently a CFP to + // update these courses, and we want people working on these updates to + // browse their content if they know the URL. + .filter((courseRecord) => { + return !courseRecord.isHidden; + }) + // Sort the course records by their priority + // Eg, 'intro' courses should be listed first before more advanced topics. + .sort((a, b) => a.priority - b.priority); + + const courseCards: Array = filteredCourseRecords.map( + (record) => { + return { + type: "blog", + eyebrow: + record.lessons.length > 0 && `${record.lessons.length} Lessons`, + body: record.description, + callToAction: { + hierarchy: "link", + size: "md", + label: "Start Course", + endIcon: "arrow-up-right", + iconSize: "sm", + url: record.href, + }, + backgroundImage: { + src: record.image || `/opengraph/developers/courses/${record.slug}`, + }, + isFeatured: false, + }; + }, + ); return ( @@ -73,7 +81,7 @@ export default function DeveloperCoursesIndex({ description={t("developers.guides.seo-description")} /> - +
{/* @ts-expect-error */} diff --git a/src/types/content-api.ts b/src/types/content-api.ts index 4d0dab2db..2d11bcdd8 100644 --- a/src/types/content-api.ts +++ b/src/types/content-api.ts @@ -77,6 +77,10 @@ export type ContentRecordBase = ContentApiNavItem & { // Priority priority?: number | undefined; + // Only hides from UI, as there's a CFP to update it and people + // that know the URL should still be able to access it. + isHidden?: boolean | undefined; + /** The next record */ next?: ContentApiNavItem; /** The previous record */