--- import Base from '../../layouts/Base.astro'; import PageHero from '../../components/PageHero.astro'; import { getDb } from '../../lib/db'; import { listPublished, countPublishedByCategory } from '../../lib/posts'; import { CATEGORIES } from '../../lib/blog-const'; export const prerender = false; const PER_PAGE = 9; const url = Astro.url; const category = url.searchParams.get('categoria') ?? undefined; const page = Math.max(1, Number(url.searchParams.get('pagina') ?? '1') || 1); const { items, total } = listPublished(getDb(), { category: category && (CATEGORIES as readonly string[]).includes(category) ? category : undefined, page, perPage: PER_PAGE, }); const pages = Math.max(1, Math.ceil(total / PER_PAGE)); // Conteggi per categoria: mostrati accanto ai filtri, così si vede subito dove c'è materiale. const perCategoria = countPublishedByCategory(getDb()); const totalePubblicati = Object.values(perCategoria).reduce((n, v) => n + v, 0); const fmt = (d: string | null) => d ? new Intl.DateTimeFormat('it-IT', { dateStyle: 'long' }).format(new Date(d)) : ''; const linkFor = (cat?: string, p = 1) => { const q = new URLSearchParams(); if (cat) q.set('categoria', cat); if (p > 1) q.set('pagina', String(p)); const s = q.toString(); return `/blog${s ? `?${s}` : ''}`; }; ---

Blog & Edugo

Edugo è lo spazio di InsanityLab dedicato alla conoscenza: articoli, guide e approfondimenti su allenamento, nutrizione e salute per capire il corpo e migliorare il proprio benessere. Perché la conoscenza è il primo passo del cambiamento.

{items.length === 0 ? (

Nessun articolo pubblicato{category ? ' in questa categoria' : ''}, torna a trovarci presto.

) : (
{items.map((post) => ( ))}
)} {pages > 1 && ( )}