From 542b8fa72ce074e4038f44787053ec9766e4f1e6 Mon Sep 17 00:00:00 2001 From: Gregor Zurowski Date: Wed, 24 Sep 2025 12:10:01 +0200 Subject: [PATCH 1/2] Add Highwire Press tags to the paper page's metadata section --- lib/metadata-helpers.ts | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/lib/metadata-helpers.ts b/lib/metadata-helpers.ts index 93f4df989..5a0f394d8 100644 --- a/lib/metadata-helpers.ts +++ b/lib/metadata-helpers.ts @@ -23,6 +23,26 @@ export function getWorkMetadata({ })), }); + // Highwire Press metadata tags + const pdfFormat = work.formats?.find((f) => f.type === 'pdf'); + const publicationType = + work.type === 'preprint' ? 'preprint' : work.type === 'review' ? 'review' : 'article'; + + const authorNames = work.authors?.map((a) => a.authorProfile?.fullName).filter(Boolean); + + const highwireTags: Record = { + citation_title: work.title, + citation_publication_date: work.publishedDate || work.createdDate, + citation_publisher: 'ResearchHub', + citation_type: publicationType, + ...(work.doi && { citation_doi: work.doi }), + ...(work.journal?.name && { citation_journal_title: work.journal.name }), + ...(pdfFormat?.url && { citation_pdf_url: pdfFormat.url }), + ...(authorNames?.length && { + citation_author: authorNames.length === 1 ? authorNames[0] : authorNames, + }), + }; + return { ...buildArticleMetadata({ title, @@ -36,8 +56,12 @@ export function getWorkMetadata({ ...(structuredData && { other: { 'application/ld+json': JSON.stringify(structuredData), + ...highwireTags, }, }), + ...(!structuredData && { + other: highwireTags, + }), }; } From f33d1859a0a8bdbb58e9e41152a7abbaa00107a3 Mon Sep 17 00:00:00 2001 From: Gregor Zurowski Date: Wed, 24 Sep 2025 12:30:16 +0200 Subject: [PATCH 2/2] PDF format is capital case --- lib/metadata-helpers.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/metadata-helpers.ts b/lib/metadata-helpers.ts index 5a0f394d8..a76fce3a6 100644 --- a/lib/metadata-helpers.ts +++ b/lib/metadata-helpers.ts @@ -24,7 +24,7 @@ export function getWorkMetadata({ }); // Highwire Press metadata tags - const pdfFormat = work.formats?.find((f) => f.type === 'pdf'); + const pdfFormat = work.formats?.find((f) => f.type.toUpperCase() === 'PDF'); const publicationType = work.type === 'preprint' ? 'preprint' : work.type === 'review' ? 'review' : 'article';