Repository navigation
Print citation counts at build time - #135
Merged
Merged
Conversation
Paper posts showed their Semantic Scholar citation count only after each reader's browser asked the keyless API, which answered 429 to 21 of 34 papers in a test. CI now fetches every count in one batch request before the build and the layout prints it, so it shows on a first view and without JavaScript. - script/fetch-citations.rb: one batch POST, retried with backoff within a deadline; on failure keeps the counts the live site published last (/citations.json); a refused SEMANTIC_SCHOLAR_API_KEY fails the run. - _plugins/citations.rb: the Semantic Scholar id per post and its count. - _data/citation_ids.yml: the record for a DOI whose arXiv id finds none or a zero-count duplicate (DeepSeek-V3); keyed by DOI, so a regenerated post keeps it. - js/citations.js: shows the newer of the build's and the browser's count and asks only when both are a day old. - jekyll.yml: the fetch step and a daily run to refresh the counts. - check-plugin-output.rb: the field is on each paper page as fetched.
This was referenced Nov 17, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Paper posts showed their Semantic Scholar citation count only after each reader's browser asked the keyless API. In a check of all 34 paper posts, 21 got 429 even after retries, so most first-time readers saw no count. Two papers never showed one: Gemini 1.0 (
arXiv:2312.11805is not in the API) and DeepSeek-V3 (its arXiv id leads to a duplicate record with 0 citations).What
script/fetch-citations.rbruns before the build in everyjekyll.ymlrun, plus a new daily run (20:41 UTC). It sends one batch request for all papers, with backoff and a 240 s deadline, and writes_data/citations.json, which is not in Git./citations.json, a new page).SEMANTIC_SCHOLAR_API_KEY(now a repository secret), the run fails._plugins/citations.rbsets each post's Semantic Scholar id and its fetched count._layouts/post.htmlrenders the count on the server, so it shows without JavaScript._data/citation_ids.ymloverrides the lookup id per DOI. It is keyed by DOI, so regenerating a post in scholar-lens keeps it. It has one entry, for DeepSeek-V3.js/citations.jsshows the newer of the build's count and the browser's count, and calls the API only when both are a day old (the build's count gets 6 h more). A cached zero never hides a count.script/check-plugin-output.rbchecks that each paper page has the field with the count that was fetched, or is hidden when there is none.docs/architecture.md(how it works, known limits) anddocs/operations.md(runbook).No change to
_data/post_conventions.ymland no new lint rule; scholar-lens is unaffected.Verification
validate-site.sh: all pass.check-plugin-output.rbcaught three deliberately broken pages.