Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | 5x 5x 5x 10x | import { LONG_DATE } from "../../../../i18n/dateFormats";
import type { Article } from "../../shared/types/Article";
import type { Journal } from "../../shared/types/Journal";
interface MetaTag {
name: string;
content: string;
}
// In the byline's zone, so Scholar and the page agree on the day; en-CA formats it as YYYY-MM-DD
const ISO_DAY = new Intl.DateTimeFormat("en-CA", { timeZone: LONG_DATE.timeZone });
const scholarDate = (date: string): string => ISO_DAY.format(new Date(date)).replaceAll("-", "/");
/** Google Scholar's tags: title, one per author and the date are the three it requires. */
export const toCitationMeta = (article: Article, journal: Journal): MetaTag[] => [
{ name: "citation_title", content: article.title },
...article.authors.map(({ name }) => ({ name: "citation_author", content: name })),
...(article.publishedAt
? [{ name: "citation_publication_date", content: scholarDate(article.publishedAt) }]
: []),
{ name: "citation_journal_title", content: journal.name },
{ name: "citation_issn", content: journal.issn },
];
|