Skip to content

fix(web): take the GitHub card's description from the repo - #527

Merged
gitfromwildan merged 1 commit into
mainfrom
fix/github-card-description
Nov 11, 2026
Merged

gitfromwildan merged 1 commit into
mainfrom
fix/github-card-description

Conversation

@gitfromwildan

Copy link
Copy Markdown
Member

Summary

The home page's GitHub card read stars, forks and license from the GitHub API, but its description was written by hand:

A markdown-first documentation framework.
Human-readable source. Flat static output.

That no longer matches the repo's own description, "A markdown-first documentation framework. Write with common mark and directives, compile to flat static HTML.". The card now shows the repo's description.

Change

OpenSource.astro:

  • Build time: the description comes from the same repos/DocuBook/docubook response as the stats, so the first paint already shows it. An offline or rate-limited build keeps the old text, without the <br />, as its fallback, the way the stats keep their placeholders.
  • Browser refresh: the cached stats gain a description field, and the existing refresh (7-day localStorage cache, fetched near the viewport) updates the text along with the numbers. A cache entry written before this change has no description, so it leaves the build-time text in place instead of blanking it.
  • data-repo / data-built-at move from the stats row to a wrapper around the description and the stats, so the script reaches both. The wrapper keeps the card's 23px gap, so the layout is unchanged.
  • Repo name and URL: DocuBook / docubook and github.com/DocuBook/docubook on the card are derived from site.github instead of being repeated as literals.

Verification

Against the production build (astro build + astro preview) in Chromium:

  • Build time: the built index.html carries the API description, and the card renders it with the stats (20 stars, 5 forks, MIT).
  • Fresh cache: a cache entry with a description replaces both the text and the stats.
  • Old cache: an entry without a description updates the stats and keeps the build-time text.
  • Layout: a screenshot of the card shows the same layout as before.
  • Typecheck: astro sync && tsc --noEmit passes.

The offline fallback (built?.description || the old text) was not exercised with the network down.

The home page's GitHub card already read stars, forks and license from
the GitHub API, but its description was written by hand ("Human-readable
source. Flat static output.") and no longer matched the repo's own
description. It now comes from the same API response: fetched at build
time for the first paint, and refreshed in the browser through the
existing 7-day localStorage cache. An offline or rate-limited build
keeps the old text as the fallback, and a cache entry written before
the description was stored leaves the build-time text in place.

The repo name and URL on the card are derived from site.github instead
of being repeated as literals.
@vercel

vercel Bot commented Nov 11, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated
docu Ignored Ignored Nov 11, 2026 1:17am UTC

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found.

Reviewed changes

Mode: standard — this is a change to the pages/ marketing site only (private @docubook/web, so no changeset is needed). I checked the build-time and browser paths of the GitHub card in OpenSource.astro.

  • Description from the API at build time — initial.description comes from the existing repos/${repo} fetch. If that value is missing or an empty string, it falls back to the old copy, now joined with a space where the <br /> used to be.
  • Description in the browser refresh — Stats gets an optional description, the fetch caches j.description ?? null, and the text is only swapped when there is a value. A cache entry from before this change, or a repo with an empty description, keeps the text rendered at build time. In practice this guard only matters when the new build ran offline (builtAt = 0). Otherwise, cache entries written before this change are older than builtAt and the existing cached.at > builtAt check already skips them.
  • Wrapper move — data-repo / data-built-at now sit on a flex-col gap-[23px] wrapper around the description and the stats. It is still the only [data-repo] on the site, so document.querySelector("[data-repo]") resolves the same element scope.
  • Derived repo label and URL — repo.replace("/", " / ") and github.com/{repo} render the same text as the old literals, because site.github (https://github.com/DocuBook/docubook) has no trailing slash.

Overall assessment: READY. Top priorities: none.

Pullfrog  | View workflow run | Using claude-opus-5-5 | 𝕏

@gitfromwildan
gitfromwildan merged commit 6b4c5de into main Nov 11, 2026
15 checks passed
@gitfromwildan
gitfromwildan deleted the fix/github-card-description branch November 11, 2026 01:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant