--- import HtmlEmbed from "./HtmlEmbed.astro"; import { type HeroProps, type Author, normalizeAuthors, stripHtml, slugify, } from "./heroUtils"; const { title, titleRaw, description, authors = [], affiliations = [], affiliation, published, doi, pdfProOnly = false, showPdf = true, } = Astro.props as HeroProps; const normalizedAuthors: Author[] = normalizeAuthors(authors as any); const authorAffiliationIndexSet = new Set(); for (const author of normalizedAuthors) { const indices = Array.isArray(author.affiliationIndices) ? author.affiliationIndices : []; for (const idx of indices) { if (typeof idx === "number") authorAffiliationIndexSet.add(idx); } } const shouldShowAffiliationSupers = authorAffiliationIndexSet.size > 1; const hasMultipleAffiliations = Array.isArray(affiliations) && affiliations.length > 1; const pdfBase = titleRaw ? stripHtml(titleRaw) : stripHtml(title); const pdfFilename = `${slugify(pdfBase)}.pdf`; --- {description && {description}} { normalizedAuthors.length > 0 && ( Author{normalizedAuthors.length > 1 ? "s" : ""} {normalizedAuthors.map((a, i) => { const supers = shouldShowAffiliationSupers && Array.isArray(a.affiliationIndices) && a.affiliationIndices.length ? ( {a.affiliationIndices.join(", ")} ) : null; return ( {a.url ? {a.name} : a.name}{supers}{i < normalizedAuthors.length - 1 && } ); })} ) } { Array.isArray(affiliations) && affiliations.length > 0 && ( Affiliation{affiliations.length > 1 ? "s" : ""} {hasMultipleAffiliations ? ( {affiliations.map((af) => ( {af.url ? ( {af.name} ) : ( af.name )} ))} ) : ( {affiliations[0]?.url ? ( {affiliations[0].name} ) : ( affiliations[0]?.name )} )} ) } { (!affiliations || affiliations.length === 0) && affiliation && ( Affiliation {affiliation} ) } { published && ( Published {published} ) } {doi && ( DOI {doi} )} {showPdf && ( PDF - you are PRO - pro only Checking access... Download PDF Subscribe to Pro )} {showPdf && ( )}
{description}
{affiliations[0]?.url ? ( {affiliations[0].name} ) : ( affiliations[0]?.name )}
{affiliation}
{published}
{doi}
Checking access...
Download PDF