X Tutup
Skip to content

Fix ebooks toggle visibility on author page #11914

Merged
mekarpeles merged 1 commit intointernetarchive:masterfrom
bhardwajparth51:fix-issue-11910-ebook-toggle
Feb 24, 2026
Merged

Fix ebooks toggle visibility on author page #11914
mekarpeles merged 1 commit intointernetarchive:masterfrom
bhardwajparth51:fix-issue-11910-ebook-toggle

Conversation

@bhardwajparth51
Copy link
Contributor

Closes #11910

Technical

The ebook/everything toggle in templates/type/author/view.html was wrapped in a $if books_count > 1: block, causing it to disappear when search results returned 0 or 1 works.

The fix applies asymmetric visibility logic:

  • "Show only ebooks" is shown when mode=everything and books_count > 0 (no point filtering down to ebooks if there's nothing to filter)
  • "Show everything" is always shown when mode=ebooks, regardless of count, so users can always escape back to the full unfiltered view

Testing

  1. Go to an author page locally, e.g. http://localhost:8080/authors/OL18319A/Mark_Twain
  2. Search for a term that returns a single result, e.g. ?mode=everything&q=Huckleberry
  3. Confirm "— Show only ebooks?" is visible with 1 result
  4. Click it — confirm you land on mode=ebooks view with "— Show everything by this author?" still visible
  5. Search ?mode=ebooks&q=Huckleberry123 — confirm "— Show everything by this author?" remains visible even with 0 results

Screenshot

1 work — "Show only ebooks?" visible:
image

1 work — "Show everything?" visible:
image

0 works — "Show everything by this author?" visible:
Screenshot from 2026-02-24 11-23-40

Stakeholders

@mekarpeles @davidscotson

@mekarpeles mekarpeles merged commit 69c812d into internetarchive:master Feb 24, 2026
4 checks passed
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.

"Show only Ebooks/everything" toggle on author page disappears if one or no books in results

2 participants

X Tutup