From 0d8b0411cbf75f9aa6f817feac4e512a5e51ca95 Mon Sep 17 00:00:00 2001 From: Sina Iman Date: Fri, 30 Jan 2026 13:32:26 -0800 Subject: [PATCH 1/2] feat: add Browse page with paginated publication index Add a /browse page showing all publications with client-side pagination, sorting, and card-based layout. Add Browse nav link to header. Convert homepage Browse Articles button from search dialog trigger to /browse link. --- src/components/Header.astro | 4 + src/pages/browse/index.astro | 621 +++++++++++++++++++++++++++++++++++ src/pages/index.astro | 19 +- 3 files changed, 628 insertions(+), 16 deletions(-) create mode 100644 src/pages/browse/index.astro diff --git a/src/components/Header.astro b/src/components/Header.astro index 9b06c10a..4fbda2f1 100644 --- a/src/components/Header.astro +++ b/src/components/Header.astro @@ -23,6 +23,10 @@ import SearchDialog from './SearchDialog.astro'; Search + + + Browse + About diff --git a/src/pages/browse/index.astro b/src/pages/browse/index.astro new file mode 100644 index 00000000..d77f3ac1 --- /dev/null +++ b/src/pages/browse/index.astro @@ -0,0 +1,621 @@ +--- +// SPDX-FileCopyrightText: 2025 Insight Software Consortium +// SPDX-License-Identifier: Apache-2.0 + +import BasePage from '@awesome-myst/myst-awesome/layouts/BasePage.astro'; +import SearchDialog from '../../components/SearchDialog.astro'; +import Footer from '../../components/Footer.astro'; +import Header from '../../components/Header.astro'; + +import '../../styles/custom.css'; + +import { getCollection } from 'astro:content'; + +const title = "Browse - The Insight Journal"; +const description = "Browse all publications from The Insight Journal — open, reproducible biomedical imaging research."; +const lastModified = new Date(); + +const allPages = await getCollection('pages'); + +// Helper to get author name as a simple string +function getAuthorName(author: any): string { + if (!author?.name) return 'Unknown Author'; + if (typeof author.name === 'string') { + // Handle "Last, First" format + if (author.name.includes(',')) { + const parts = author.name.split(',').map((p: string) => p.trim()); + if (parts.length === 2) return `${parts[1]} ${parts[0]}`; + } + return author.name; + } + if (typeof author.name === 'object') { + if (author.name.given && author.name.family) { + return `${author.name.given} ${author.name.family}`; + } + if (author.name.literal) return author.name.literal; + } + return 'Unknown Author'; +} + +// Extract lightweight data for client-side rendering +const publications = allPages.map((page: any) => { + const fm = page.data?.frontmatter || page.frontmatter || {}; + const pubId = fm.external_publication_id || page.id; + const authors = (fm.authors || []).map((a: any) => getAuthorName(a)); + const abstractText = fm.abstract || ''; + const keywords = fm.keywords || []; + const dateSubmitted = fm.date_submitted || ''; + + return { + id: pubId, + title: fm.title || 'Untitled', + authors, + abstract: abstractText, + keywords, + date: dateSubmitted, + url: `/browse/publication/${pubId}`, + hasThumbnail: !!fm.thumbnail, + }; +}); +--- + + +
+ + + + +
+ +
+

Browse Publications

+

+
+ + +
+
+ + +
+
+ + +
+ + + +
+ + +