Add site-wide citation popovers and shared references
Description
Citations currently leave readers to find the full reference themselves. This adds clickable author–year citations with the full APA reference, source link and copy action, backed by the existing glossary bibliography. Fixes #200.
- A generic, non-modal popover module exposes
openPopover,closePopoverandregisterPopover, including the optional hover behaviour needed by #227. Its API is documented at the top ofassets/js/doors/popover.js; features should import it through the sharedsite.jsbundle. citeandreferencesshortcodes read the existingcontent/glossary/apa_lookup.jsonat build time. They support grouped and narrative citations, sorted page bibliographies and warnings for unknown keys. Generated content and its generator are unchanged.- Glossary references receive stable targets and metadata. Definitions acquire links only for unique first-author/year pairs; ambiguous and unmatched citations stay plain text.
- Pilots: citations are linked in three Educators' Corner posts: teaching replication, neurodiversity, and intersectionality. Only the citation markup changes, so each sentence reads exactly as the author wrote it.
bare="true"renders "Author, Year" inside brackets the author wrote, next to works that aren't in the bibliography. The transparency-checklist post only lists its reference, and the Gilad Feldman interview is quoted speech, so both are left unconverted. CONTRIBUTING.mddocuments authoring. The built-HTML check now rejects citation links without local reference targets, with lightweight matcher and checker tests.
Testing
- Hugo 0.158.0,
--gc --minify --cleanDestinationDir, complete build succeeds. The per-citation build warnings for glossary definitions were removed in review: they reported 219 issues in generated content on every build. - All 15
check_seo_html.pychecks pass across 3,387 HTML pages; source rules pass with no generated-path edits; sitemap/source dates pass. - 126 unit tests and 11 discipline-parser tests pass.
- Headless Chromium at 1280px and 390px: five pilots and a glossary term; Enter, Escape, outside click, close button, focus restoration, one popup, copy/1.5s reset, italic APA, source/no-source, horizontal gutters, below/above placement and links with JavaScript disabled. Screenshots inspected at both widths.
- A temporary, uncommitted fixture exercised all 708 bibliography entries, multi-key and narrative forms, undated corporate authors, alphabetical ordering and unknown-key warning/fallback. It was removed after testing.
- A second temporary build/browser fixture verified unknown keys, missing and ambiguous references, mismatched author lists, alternative definitions, existing source links, two-author narrative “and”, and the Rothers surname case.
- Corporate author lists ending in
& othersand comma-free author–year forms are covered by a further build/browser fixture. The real Authorship glossary page now links its McNutt and Patience citations. - Generic hover API checked separately: delayed opening/closing, crossing from trigger into popup, no focus theft and promotion to keyboard focus on click.
UI choices for Claude
- Existing manually maintained references on the neurodiversity pilot remain under the plain heading “Other references”; works present in the shared bibliography use the generated “References” list above it.
- Clipboard failure briefly uses the plain button text “Copy failed”, with the same 1.5s reset.
- Popover z-index is 800, below the header, cookie banner and chat.
SEO: the converted pages' descriptions are unchanged, because their text is unchanged. The neurodiversity page's description changed in an earlier version, which reworded its first sentence. Checked against the live preview.
Bibliography additions to consider
The most frequent missing works below are ranked by source-linked author/year mentions in hand-written Markdown, excluding generated paths. These are source mention counts, not scholarly citation counts; all six occur in content/reversals/reversals.md. Bare repeated mentions were excluded so different works with the same author/year are not combined. Nothing was added to the BibTeX Doc.
| Candidate, as cited on the site | Linked mentions | Existing source |
|---|---|---|
| O’Donnell et al. (2021) | 20 | https://doi.org/10.1073/pnas.2103313118 |
| Ruggeri et al. (2020) | 8 | https://www.nature.com/articles/s41562-020-0886-x |
| Catling & Elsherif (2020) | 6 | https://doi.org/10.1016/j.actpsy.2020.103138 |
| Ghyselinck et al. (2004) | 5 | https://doi.org/10.1016/j.actpsy.2003.11.002 |
| Elsherif et al. (2021) | 5 | https://doi.org/10.1016/j.jfludis.2020.105827 |
| Boekel et al. (2015) | 5 | https://doi.org/10.1016/j.cortex.2014.11.019 |
🤖 Generated by GPT-6.1 Sol (Codex); review and UI decisions by Claude Code