Repository navigation
Home page: librarian call-out and a compact stats card replace the five-chart stats block - #13831
Merged
Merged
Conversation
Under the carousels, a new row replaces the five-chart "Around the Library" block: a call-out that pitches the catalog as a commons (editable by anyone, every record public, run by a nonprofit) and sends readers to /librarians, with a compact stats card beside it. The card shows four 28-day totals (visitors, members, catalog edits, loans) with server-drawn SVG sparklines, so the home page no longer loads the flot graph bundle. A series with nothing in the window is left off, and with no admin stats at all the call-out takes the whole row. The copy deliberately doesn't promise an easy first edit: /librarians is a guide, not an onboarding flow, so the button says what it delivers. Totals are formatted compactly (1.2K, 96K, 1.2M). The sparkline hues are new chart tokens; page-home now loads the self-hosted Literata face for the headline and the figures.
The new row under the carousels makes the same invitation to /librarians, so the "Be an Open Librarian" card in the welcome carousel went with its image.
…8-day link The three facts (editable, public, nonprofit) move from a strip under the copy to a column on the right, each with an icon beside a bold term and its line, so the headline and body get the full width and the button ends the column level with the last fact. On narrow screens the card stacks: title, body, facts, then the button. Both cards share a new --spacing-inset-card token, which pairs with the existing card border and radius so cards side by side get one padding. The "28 days" link in the stats card header is gone; the window is explained in the template and the figures already link to their sources.
The row adds the Literata font-face sheet (about 1KB gzipped) and the call-out and stats card component (about 1.5KB), which puts page-home.css at 8.4KB against an 8KB cap that the page was already filling. The home bundle has no dead CSS left to trade for it, so the cap moves, as it did at 6KB and 7KB when the page last grew.
Dropping the "28 days" link left the card's four totals with no stated period. The window returns as plain text at the end of the heading row, in the same overline style as the title but muted, so it reads as a label rather than a link.
# Conflicts: # static/css/components/home.css
# Conflicts: # static/css/tokens/colors.css
The headline is now "A library made by the people who use it.", the body "A catalog for every book ever published, maintained by readers like you.", and the button "Become an Open Librarian".
The stats card loses height: the overline-to-grid and grid row gaps drop from 24px to 16px, the figures step down to headline-small, and the sparklines shrink from 28px to 20px. The call-out's facts column widens to 240px so each fact fits on one line, and the button now follows the body instead of being pushed to the card's bottom edge. The leftover hover rule on the "Last 28 days" span is gone; it stopped being a link earlier on this branch.
Collaborator
|
Let me know when it's ready for review. We should coordinate about: #13901 |
# Conflicts: # openlibrary/i18n/messages.pot # openlibrary/plugins/openlibrary/tests/test_home.py # openlibrary/templates/home/index.html # static/css/components/home.css # static/css/page-home.css
… 28 days Each sparkline now draws the 7-day average, so the weekend dip no longer hides which way a series is going, and its scale always spans at least 30% of the peak: a doubling fills the box, a few percent stays a ripple. Days Graphite has no count for (it reports them as 0 or None, often for the last several days) are skipped instead of plunging the line to the floor. Beside each total, the change in the daily average from the 28 days before (e.g. "↑ 15%"), which needs 56 days of counts, so the home page now asks get_stats for both windows. Screen readers get the same as the sparkline's label. Local dev's mock stats were a straight line falling to zero; they're now shaped like production's (weekend dip, noise, a gentle climb, prod scale), oldest first, and seeded so a reload doesn't redraw them.
The labels read as names (Unique Visitors, New Members, Catalog Edits, eBooks Borrowed), matching the old block's wording. The change figure now shows only when a series went up; a dip or a flat month leaves the total and its sparkline to speak for themselves.
Also flattens the nested min() in sparkline_points that ruff flags.
The old title said nothing the numbers didn't; the time window is what a reader needs, so it takes the heading's place at the top left. The rise's hover text and screen-reader label now compare with "the month before" to match.
The scale floor drops from 30% of the peak to 12%, so a month that's up 15% climbs the whole box instead of half of it. Day-to-day wobble in the 7-day average stays small.
archive.org/stats is behind a login for most readers, so the figure now goes to Open Library's own stats page, like New Members.
… last The figure compared this month's daily average with last month's, while the line only draws this month, so they could disagree: on testing, Books Read peaked early and slid, yet showed up 7%. It's now the change between the week ending on the window's first day and the week ending today, the same 7-day averages the line plots at its ends, so the two always agree. The page fetches 34 days instead of 56.
RayBB
reviewed
Oct 15, 2026
| @@ -1,4 +1,4 @@ | |||
| $def with (stats=None, blog_posts=None, test=False, featured_subjects=[], carousel_data=None) | |||
| $def with (stats=None, blog_posts=None, test=False, featured_subjects=[], carousel_data=None, library_stats=None) | |||
Collaborator
There was a problem hiding this comment.
stats=None isn't used anymore. Should be dropped.
Also,
Drop stats=stats from the render_template(...) call in get_homepage
Alternatively, just use that parameter to pass the new library stats thing you're passing!
Every signup writes a `new-account` transaction, and at ~10k signups a day they made up most of what /stats and the home page reported as "Human edits" (today: 12,166 edits, 9,147 of them signups). Both edit counters now skip account creation and a few admin housekeeping actions, so the number reflects changes to the catalog.
The visitors figure comes from an archive.org Graphite feed that is days behind and reports several times the traffic it did a year ago, so the card drops it. In its place, a new daily count of list saves (create-list and edit-list-seeds transactions), gathered by the stats cron like the edit counts. Until the daily docs carry it, the card shows lists created instead, then switches over on its own. Tile hover is now a background fill rather than an underlined label.
# Conflicts: # bundlesize.config.json # openlibrary/i18n/messages.pot # openlibrary/plugins/openlibrary/home.py # openlibrary/plugins/openlibrary/tests/test_home.py # openlibrary/templates/home/index.html
RayBB
approved these changes
Oct 15, 2026
RayBB
left a comment
Collaborator
There was a problem hiding this comment.
Code is in really good shape and it looks beautiful.
We talked about this a bit on Slack.
My one recommendation is to make it so that we don't load the new font on the homepage because it is +83kb for every page view.
Otherwise I think this is a wonderful improvement!
Collaborator
|
^^ the new font is already removed |
…change Dropping signups from the human edits count cut it by about three quarters, so once deployed the home card's 28-day window would have mixed old and new days: a cliff in the sparkline and a large decline badge for three weeks. The filtered count now lives under its own key, catalog_edits, and human edits goes back to meaning every non-bot transaction, so docs already written keep their meaning. The card also now shows a series only when every doc in its window carries the key. Catalog Edits and Lists Updated fall back to the older human edits and lists created series until a full window of the new keys exists, then switch over in one go. Without the gate, a key a day old would be summed as a month. The admin page still reads human edits for now. The home template also drops its unused stats argument.
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.
Replaces the "Around the Library" charts under the home page carousels with two cards. The first invites readers to become librarians, pitching the catalog as something anyone can edit, every record public, run by a nonprofit; its button goes to /tasks. The second, headed "In the last month", is a compact snapshot of new members, books read, catalog edits and lists updated, with a sparkline for each and the rise when one went up. The old block read like an admin dashboard. The only invitation to help was a small card in the onboarding carousel, which this retires.
The screenshot predates one change: the card no longer shows unique visitors. That figure comes from an archive.org Graphite feed that runs days behind and reports several times last year's traffic, so lists updated takes its place.
Technical
get_library_statsin home.py, in place of the bar-chart block from Remove flot: homepage and /stats charts as SVG, imports and publishing history with Chart.js #13901. Each is a smoothed rolling average, and the rise is measured from its first point to its last.openlibrary/admin/numbers.pynow skipnew-accounttransactions and a few admin housekeeping actions. Signups were most of what /stats and the home page reported as "Human edits" (one day: 12,166 edits, 9,147 of them signups).list_editscount (create-list and edit-list-seeds transactions) is gathered by the stats cron alongside the edit counts. Until the daily docs carry it, the card shows lists created instead and switches over on its own.--font-family-title(Literata, falling back to Georgia), but the page doesn't load the Literata webfont, so visitors who have it installed see it and nobody downloads it.Testing
Scroll past the carousels on the home page; resize below the tablet breakpoint to see the row stack.
Follow-up
The "About the Project" section at the bottom of the home page now overlaps the librarian call-out and should be revisited.
Stakeholders