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..fb0700f4 --- /dev/null +++ b/src/pages/browse/index.astro @@ -0,0 +1,620 @@ +--- +// SPDX-FileCopyrightText: 2025 Insight Software Consortium +// SPDX-License-Identifier: Apache-2.0 + +import BasePage from '@awesome-myst/myst-awesome/layouts/BasePage.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

+

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