Roll out site-wide citation popovers, local references, and citation cards (#200)

Merged
LU
4d ago
+3136-148

Summary

PR #1062 introduced site-wide citation popovers ({{< cite >}}, {{< references >}}, {{< citation-card >}}) backed by content/glossary/apa_lookup.json, but only piloted them on three Educators' Corner posts, cite_us.md, glossary terms, and two citation-card pages. Readers on the rest of the site still met plain-text citations, split reference lists, raw URLs inside popovers with no open-access indicator, and unstyled "How to cite" blocks without copy buttons.

This PR audits all non-generated pages on rebrand-doors, redesigns the citation popover into a lighter APA card with build-time OpenAlex/Unpaywall open-access enrichment (showing OA status and direct free-to-read links when a DOI is paywalled), hardens citation infrastructure for widget_page sections and page-local APA reference lists, and rolls out popovers, unified hanging-indent reference lists, and standardized citation cards across 12 hand-written pages.

Fixes #200

What changed

Citation popover redesign & build-time Open Access enrichment

  • Compact APA + action-bar popover (assets/js/doors/citations.js, assets/js/doors/popover.js, assets/css/doors/popover.css):
    • Quiet header row with an unlocked/locked padlock icon + OA status (Open access, Free copy · <Repository>, Paywalled, or Reference when no DOI) and an aligned × close button (44 px tap area).
    • Verbatim APA reference body with trailing raw https://doi.org/... / Available at: URL clutter stripped from display while Copy reference always copies the complete reference including its DOI/URL.
    • --surface footer bar pairing clean action links (Read free PDF ↗ / Read free copy ↗ + DOI ↗ for Green OA, Read article ↗ for direct OA, Publisher DOI ↗ for paywalled, Open source ↗ for non-DOI URLs) with an outlined Copy reference button and animated checkmark feedback.
    • Popovers reserve space for .site-head (when in view) and visible .cc-window cookie banners, clamp top and maxHeight together, and sit at z-index: 950 (above the collapsed Just-OS launcher at 900; below header at 1000 and open chat at 10000).
  • Build-time OpenAlex + Unpaywall OA enrichment (scripts/enrich_citation_oa.py, data/citation_oa.json, .github/workflows/data-processing.yml, layouts/partials/citations/metadata.html, layouts/partials/citations/entry.html, scripts/rebrand/check_source_rules.py):
    • Batched OpenAlex Works API lookup (40 DOIs/request, Unpaywall fallback for misses, 90-day cache) covering both content/glossary/apa_lookup.json and {{< local-references >}} DOIs — 429 / 431 DOIs enriched (208 direct OA, 78 paywalled papers with Green OA free copies, 143 paywalled).
    • Runs in data-processing.yml (offline/deterministic Hugo builds; zero runtime third-party API requests from browsers).

Shortcodes, author lists, checks & generator fixes

  • {{< cite >}} (layouts/shortcodes/cite.html): Added optional text="..." parameter to preserve each author's exact visible wording and punctuation while linking to #ref-<key>.
  • {{< local-references >}} (layouts/shortcodes/local-references.html): New paired shortcode for pages with manual APA reference lists not in apa_lookup.json. Merges any {{< cite >}} entries from .Page.Store alphabetically into one <ul class="references-list" data-local-references="true"> with author-collapse toggles and local-<md5> keys.
  • Page-local auto-linking (assets/js/doors/citations.js, assets/js/doors/citation-matches.js): Runs conservative author-year matching on .article-style when [data-local-references] is present (skipping links, headings, code, summaries, reference lists, citation cards, and glossary layouts), including optional p./pp. page locators on both parenthetical and narrative citations.
  • Author-list display (layouts/partials/citations/authors.html, layouts/shortcodes/citation-card.html, layouts/shortcodes/cite-us.html, assets/css/doors/citations.css): Suggested citations ({{< citation-card >}} and {{< cite-us >}}) now show up to 10 authors in full before collapsing (reference lists keep 5), and .ref-authors-toggle is styled as a plain inline underlined link instead of a floating bordered pill.
  • APA metadata & bibliography generator (layouts/partials/citations/metadata.html, bibtex_to_apa/bibtex_to_apa.js): Extended date regex for APA 7 full dates like (2021a, July 12) and hardened URL/DOI extraction for parenthetical DOIs (10.1002/(SICI)...); fixed bibtex_to_apa.js to normalise , & et al. → , et al. (Klein2014) and ^Forrt. → FORRT. (FORRT2019) on the next data-processing.yml run.
  • Reference list formatting & card CSS deduplication (assets/css/doors/citations.css, layouts/shortcodes/citation-card.html): Styled non-glossary .article-layout .article-style ul.references-list with clean APA hanging indents (1.5em) and overflow-wrap: anywhere; deduplicated cite_us.css <link> per page via .Page.Store.
  • Checks & docs (scripts/check_seo_html.py, scripts/tests/, CONTRIBUTING.md): Extended Check 15 to verify every a.cite[data-cite] resolves to a matching [data-reference] entry and fail on truncated data-source DOIs/URLs (both unbalanced parentheses and balanced-prefix truncation); added unit tests (test_enrich_citation_oa.py, test_citation_matches.py, test_check_seo_html.py).

Content rollout (12 non-generated pages)

  • Shared bibliography citations ({{< cite >}} + {{< references >}}):
    • content/manuscript/manuscript.md (widget_page): 4 exact citations inside {{< expand >}} (Vazire2018, Nosek2012Bar_Anan, Nosek2012b, FORRT2019) + {{< references >}}.
    • content/reversals/reversals.md (widget_page): 24 verified citations across 7 exact DOI-matched papers (Klein2014 ×12, EbersoleEtAl2016 ×5, Clark2019 ×2, Simonsohn2014effect ×2, Kerr2018 ×1, Mellers2001 ×1, Klein2018ManyLabs2 ×1) + {{< references >}} + standardized {{< citation-card >}} under How to cite.
    • content/educators-corner/011-intersectionality-open-science/index.md: 2 remaining citations (HenrichHeineNorenzayan2010, BahlaiEtAl2019) preserving exact visible text.
  • Page-local APA reference lists ({{< local-references >}}):
    • content/educators-corner/010-Neurodiversity/index.md: Unified split {{< references >}} + ### Other references (31 raw paragraphs) into one alphabetical ## References list (34 entries, 32 live popovers, 12 author toggles, References link in TOC).
    • content/educators-corner/018-accessible-feedback-in-research/index.md: Wrapped 8 manual references (7 live popovers).
    • content/educators-corner/016-reviewer-zero/index.md: Wrapped 5 manual references (all 5 live popovers) and removed 2 broken Zotero Google Docs draft links.
    • content/dei/2-intro-text.md (widget_page): Wrapped 4 manual references (all 5 in-text citations live, linking Henrich, Heine & Norenzayan, 2010 to the Nature 2010 entry listed on that page).
  • Standardized {{< citation-card >}} blocks:
    • content/pedagogies/001-Julia-Strand/index.md, 002-Gilad-Feldman/index.md, 003-CREP/index.md, 004-Thomas-Rhys-Evans/index.md (all 6 authors on 004 shown in full under the 10-author suggested-citation limit).
    • content/neurodiversity/neurodiversity.md (both Bibliographic Reference spoilers, with inline Show all 14 authors link on the 14-author entry).

Before & After

manuscript — Green OA popover (Free copy · OSF + DOI, 1440 px & 390 px)

Before (1440 px)After (1440 px)After (390 px)
manuscript-before-1440manuscript-after-1440manuscript-after-390

reversals — Direct Open Access popover + inline author link (1440 px & 390 px)

Before (1440 px)After (1440 px)After (390 px)
reversals-popover-before-1440reversals-popover-after-1440reversals-popover-after-390

Paywalled DOI (ec011) & Non-DOI local reference (ec018, 1440 px & 390 px)

Paywalled DOI (ec011, 1440 px)Non-DOI source (ec018, 1440 px)Non-DOI source (ec018, 390 px)
ec011-paywalled-after-1440ec018-after-1440ec018-after-390

Unified hanging-indent references (ec010 & ec004) and full-author citation card (ped004)

ec010 Before (1440 px)ec010 After (1440 px)
ec010-refs-before-1440ec010-refs-after-1440
ped004 Before (1440 px)ped004 After (1440 px)
ped004-before-1440ped004-after-1440
ec004 Before (1440 px)ec004 After (1440 px)
ec004-refs-before-1440ec004-refs-after-1440

Decisions to review

  • Reversals How to cite wording & DOI links (content/reversals/reversals.md): "Please cite this source as Hartmann H…" was split into "Please cite this source as:", the {{< citation-card >}}, and "Contributors are listed…" as its own paragraph. Also, the 24 converted citations now open citation popovers alongside direct blue DOI links for non-bibliography studies on the same lines.
  • Unwrapped broken Zotero draft links (content/educators-corner/016-reviewer-zero/index.md): Removed two broken https://www.zotero.org/google-docs/?... links around (Silbiger & Stubler, 2019) and (Hamedani & Markus, 2019) (visible text unchanged) so they link to the page's References popovers instead.
  • Inferred matches on ec011 (content/educators-corner/011-intersectionality-open-science/index.md): HenrichHeineNorenzayan2010 (BBS WEIRD paper) and BahlaiEtAl2019 were matched from context since 011 has no existing reference list — please confirm.
  • Deliberately skipped pages: content/neurodiversity-lessonbank/ (deferred to avoid PR #1294 conflicts), content/educators-corner/022-repro-metrics-forrt-irise/index.md (Vancouver numeric style), and all verified false-positive same-author-year traps.
  • Upstream bibliography quirks: Hardened bibtex_to_apa/bibtex_to_apa.js so FORRT2019 (Forrt.) and Klein2014 (, & et al.) normalise automatically on the next data-processing.yml run; apa_lookup.json itself is not hand-edited here per AGENTS.md.

Checks

  • hugo --gc --minify (0 errors, 0 new warnings) & node --check bibtex_to_apa/bibtex_to_apa.js
  • python3 -m unittest scripts/tests/test_citation_matches.py scripts/tests/test_check_seo_html.py scripts/tests/test_enrich_citation_oa.py (58 tests OK) and python3 -m unittest discover -s scripts -p 'test_parse_disciplines_gdoc.py' (11 tests OK)
  • python3 scripts/rebrand/check_source_rules.py --base origin/rebrand-doors (0 hard-coded URLs, 0 generated files changed)
  • python3 scripts/check_seo_html.py (all 28 checks PASS across 3,425 pages)
  • python3 scripts/rebrand/compare_builds.py (0 removed paths, 0 added addresses, 0 structured-data drops, 0 SEO tag changes)
  • axe-core audit on the redesigned Option B citation popover + modified pages (0 WCAG A/AA violations)
  • Playwright E2E suite at 1440 px & 390 px (Green OA, Open access, Paywalled, non-DOI Reference states; Copy reference preserves full DOI on clipboard while raw URL is hidden from display; inline author toggle; 10-author suggested citations; glossary regression check; 0 console/page errors)

Created with Gemini 4 Neon in Antigravity (reviewed with Claude Opus 5.5).