import type { Metadata } from 'next'; import Link from 'next/link'; import { notFound } from 'next/navigation'; import { getCachedPayload } from '@/lib/payload'; import { absoluteUrl } from '@/lib/site'; import { getFlags } from '@/lib/flags'; import styles from './Blog.module.css'; /* * Dynamic, not ISR. * * This route has no dynamic params, so Next prerenders it at build time — and * CI builds the image with no database reachable, which fails the build. It is * a single indexed query against Postgres on the same Docker network, so * rendering per request is cheap, and it means a newly published post appears * here immediately rather than waiting on a revalidation. */ export const dynamic = 'force-dynamic'; export const metadata: Metadata = { title: 'Blog', description: 'Notes on what school performance data shows, and what it does not.', alternates: { canonical: absoluteUrl('/blog') }, }; function formatDate(value: string) { return new Date(value).toLocaleDateString('en-GB', { day: 'numeric', month: 'long', year: 'numeric', }); } export default async function BlogIndexPage() { const flags = await getFlags(); if (flags.blog !== true) notFound(); const payload = await getCachedPayload(); const { docs } = await payload.find({ collection: 'posts', where: { _status: { equals: 'published' } }, sort: '-publishedAt', limit: 50, depth: 0, }); return (
Blog
What school performance data shows, what it doesn't, and how to read it without being misled. Written by{' '} {/* Plain text when about_page is dark: the two flags are independent, so this link would otherwise point at a 404. */} {flags.about_page === true ? Tudor : 'Tudor'}.
No posts yet.
) : ({post.excerpt}