Repository navigation
fix(web): take the GitHub card's description from the repo - #527
Merged
Merged
Conversation
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.
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Contributor
There was a problem hiding this comment.
✅ 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.descriptioncomes from the existingrepos/${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 —
Statsgets an optionaldescription, the fetch cachesj.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 thanbuiltAtand the existingcached.at > builtAtcheck already skips them. - Wrapper move —
data-repo/data-built-atnow sit on aflex-col gap-[23px]wrapper around the description and the stats. It is still the only[data-repo]on the site, sodocument.querySelector("[data-repo]")resolves the same element scope. - Derived repo label and URL —
repo.replace("/", " / ")andgithub.com/{repo}render the same text as the old literals, becausesite.github(https://github.com/DocuBook/docubook) has no trailing slash.
Overall assessment: READY. Top priorities: none.
claude-opus-5-5 | 𝕏
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.

Summary
The home page's GitHub card read stars, forks and license from the GitHub API, but its description was written by hand:
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:repos/DocuBook/docubookresponse 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.descriptionfield, 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-atmove 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.DocuBook / docubookandgithub.com/DocuBook/docubookon the card are derived fromsite.githubinstead of being repeated as literals.Verification
Against the production build (
astro build+astro preview) in Chromium:index.htmlcarries the API description, and the card renders it with the stats (20 stars, 5 forks, MIT).astro sync && tsc --noEmitpasses.The offline fallback (
built?.description ||the old text) was not exercised with the network down.