-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Description
Issue Refinement
Summary
The "Locate" button currently redirects patrons off-site to WorldCat when a book isn't available to borrow or read on Open Library. This issue proposes keeping those patrons on-site by redirecting the button to the OL edition/book page itself, specifically to a section surfacing price/vendor purchasing options and nearby library availability. Given the button receives hundreds of thousands of clicks, this is a meaningful retention opportunity and could improve discoverability of the already-existing vendor and library data we surface on edition pages.
The proposal is directionally clear but technically underspecified — the "locate section" it refers to may already partially exist (the edition page has both WorldcatLink and affiliate buy links in a mobile-vendor panel), but it's unclear whether those sections need to be redesigned, promoted, or if a new anchor-targeted section is needed.
Requirements
- Determine whether the existing edition page vendor/library sections (WorldCat link + affiliate links) are sufficient as a "locate" destination, or if a new dedicated section is needed
- Change the Locate button href from
/books/{key}/-/borrow?action=locateto/books/{key}#locate(or equivalent anchor) - Optionally: remove or repurpose the
action=locateserver-side redirect inborrow.py(L126–127) - The "locate" section on the edition page should prominently surface: nearby library availability (currently WorldCat link) + purchase options (currently affiliate links)
- Confirm the section renders correctly for editions missing ISBN/OCLC identifiers (graceful degradation)
- Verify analytics tracking — current
data-ol-link-track="CTAClick|Locate"should continue working
Success Criteria
- Clicking "Locate" no longer sends patrons to WorldCat; they stay on the OL edition page
- The edition page "locate" destination contains meaningful library and vendor data
- Analytics confirm a measurable reduction in off-site WorldCat referrals and/or improvement in on-site session continuity
- All existing tests pass; LocateButton continues to render in search results, carousels, and the edition read panel
Relevant Files, Components, & Changes
openlibrary/macros/LocateButton.html— renders the Locate CTA button;locateUrlcurrently points toborrow?action=locate. This is the primary change point for the href.openlibrary/plugins/upstream/borrow.py#L126-L127—action == 'locate'triggersweb.seeother(edition.get_worldcat_url()). This redirect should be removed or changed.openlibrary/plugins/upstream/models.py#L112-L119—get_worldcat_url()on the Edition model; may become vestigial if this feature ships.openlibrary/templates/type/edition/view.html#L310-L321— the existingmobile-vendorpanel withWorldcatLink+Buy this book/affiliate_links; the "locate section" destination likely lives here.openlibrary/macros/WorldcatLink.html— "Check nearby libraries" section that still links to WorldCat; consider whether this should also be revised or if it's acceptable as a secondary link.openlibrary/macros/LoanStatus.html#L139-L152— rendersLocateButtonin the fallback$elsebranch when a book is not borrowable/readable.
Reference commits (upstream internetarchive/openlibrary):
- #9952 — closed Dec 2024, introduced
LocateButton.htmland theborrow?action=locateflow in the first place (by@SivanC). This is the direct predecessor to this issue.
Related Issues, PRs, Dependencies
- internetarchive/openlibrary#9952 ✅ closed/completed — "Replace 'Not In Library' with Locate button" — introduced the current Locate→WorldCat flow this issue proposes to change
- internetarchive/openlibrary#5831 ✅ closed — "Unified Read Button Dropper" — related work on the read panel button architecture
Risks, Considerations, Uncertainties
- WorldCat still in the loop: The edition page's
WorldcatLinkmacro still links out to WorldCat. This issue may partially address off-site exits but doesn't eliminate them — worth discussing whether WorldCat links on the book page itself should also eventually be replaced. - Editions without rich metadata: Editions lacking ISBN/OCLC/affiliate data will have a sparse or empty "locate section." The UX for those cases needs explicit design consideration.
- Search results / carousels: The
LocateButtonrenders in non-edition contexts (search, carousels) where there's no full edition page sidebar. A redirect to/books/{key}from those surfaces should still work, but the anchor behavior needs verification. - Analytics continuity: The current
CTAClick|Locatetracking fires on the button click regardless of destination. If the URL changes significantly, ensure the tracking attribute still fires. - Performance: The edition page has render timers. Adding a prominent new section may require caching consideration, especially if vendor/library API calls (BetterWorldBooks, etc.) are invoked on more page loads.
- Proposal vagueness: The issue body has empty
ProposalandRequirements Checklistfields. This needs fleshing out before a contributor picks it up.
🔔 Stakeholders Notified
- @mekarpeles — issue author and program lead; the "hundreds of thousands of clicks" data point likely came from internal analytics, needs to provide destination spec
@cdrini— owns search/editions infrastructure; Locate button renders in search results and carousels, changes there need his eyes@lokesh— front-end/design lead; if a new "locate section" needs to be designed or the edition page sidebar needs redesign, this is his domain
Prescriptions
Needs: Breakdownis correctly applied — the proposal lacks a concrete spec for what the "locate section" looks like on the book page. Before a contributor starts, someone needs to answer: does the existingmobile-vendorpanel suffice, or does a new#locateanchor section need to be built?Needs: Leadis correctly applied — this touches a high-traffic CTA and requires a product-informed decision on destination design.- The mechanical change in
borrow.pyandLocateButton.htmlis straightforward (~2–3 lines), but the design/scope of the destination section is the real work. - Once scoped, the backend change (removing the
action=locateredirect) could be a Good First Issue in isolation.
Breakdown
Implementation Details (for maintainers)
Related files
Refer to this map of common Endpoints:
*
Requirements Checklist
Checklist of requirements that need to be satisfied in order for this issue to be closed:
- [ ]
Stakeholders
Instructions for Contributors
- Before creating a new branch or pushing up changes to a PR, please first run these commands to ensure your repository is up to date, as the pre-commit bot may add commits to your PRs upstream.