TinyTorch fetched its star count from the GitHub API on every page load. That
is rate limited to 60 requests an hour per IP unauthenticated, so on a busy
day visitors get the catch branch and read "10k+" against a real count near
28,000; every visitor also sees "..." until the request resolves. Meanwhile a
cache of the same number already existed, refreshed every six hours by
site-refresh-stats.yml and committed at site/config/stats-cache.json.
inject_stats.py moves to shared/scripts/ so any site in the repo can use it.
Only its path resolution changed: the repo root is derived from the script
location, and the output directory comes from QUARTO_PROJECT_OUTPUT_DIR,
which Quarto sets for post-render steps. Substitution, JSON escaping, the
data-stat wrapper, and the build failure on an unresolved placeholder are all
untouched.
The cache itself stays at site/config/stats-cache.json. That is where
build_stats.py writes and where the refresh workflow commits, and a second
copy would mean two numbers for one fact.
TinyTorch now renders {{stats.stars}} at build time in both the hero line and
the footer badge, and its fetchGitHubStars script is gone. The site keeps
identical output through the shared script; both were rebuilt to confirm, with
no unresolved placeholders on either.