--- import { getCollection } from 'astro:content'; import Base from '../../layouts/Base.astro'; // Paginated archive via Astro's built-in paginate(): the [...page] rest route // makes page 1 the bare /news URL, then /news/2 … /news/N. export async function getStaticPaths({ paginate }) { const posts = (await getCollection('news', ({ data }) => !data.draft)).sort( (a, b) => b.data.date.valueOf() - a.data.date.valueOf(), ); return paginate(posts, { pageSize: 24 }); } const { page } = Astro.props; const first = page.currentPage === 1; const fmt = (d) => new Intl.DateTimeFormat('en-GB', { dateStyle: 'long' }).format(d); const iso = (d) => d.toISOString().slice(0, 10); // Reading time from the Markdown body (~220 wpm) — differentiating card metadata; // category/author are identical across all articles, so cards omit them (NN/g). const readMin = (p) => Math.max(1, Math.round((p.body ?? '').split(/\s+/).length / 220)); // Windowed page list — 1 … n-1 n n+1 … last (0 marks an ellipsis) const nums = []; for (let n = 1; n <= page.lastPage; n++) { if (n === 1 || n === page.lastPage || Math.abs(n - page.currentPage) <= 1) nums.push(n); else if (nums.at(-1) !== 0) nums.push(0); } const hrefFor = (n) => (n === 1 ? '/news' : `/news/${n}`); --- {/* Section-landing archetype: white head, display Galaxy h1 + standfirst (the navy band is reserved for / and /login — DESIGN.md). */}

News & Announcements

Science highlights and updates from the observatory and its partners.

{first ? 'All news' : `All news — page ${page.currentPage}`}

{page.data.map((post, i) => (
{post.data.cover && ( )}

{post.data.title}

{post.data.description}

· {readMin(post)} min read
))}
{page.lastPage > 1 && ( )}