Refactor books page to render from a data array#20
Merged
Conversation
Move the per-book markup in books.html into a READING_LIST array in js/books.js and render it at script top-level. Adding a book is now a single object in the array instead of a 13-line HTML block. Rendering runs before DOMContentLoaded (safe under `defer`) so the scroll-reveal IntersectionObserver in theme.js still picks up the .book-item elements. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
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
<article>markup inbooks.htmlto a single<div data-reading-list>READING_LISTarray injs/books.jsand arenderReadingList()function that builds the same markup from dataWhy
One source of truth — title/author/ISBN/notes used to be duplicated across
alt,data-title,data-author, the<h3>, and theby …div, which was easy to drift.Reviewer notes
DOMContentLoaded) on purpose.js/theme.jsattaches an IntersectionObserver to.book-itemduringDOMContentLoadedfor scroll-reveal; withdefer, top-level code inbooks.jsruns after the DOM is parsed but beforeDOMContentLoadedfires, so the observer sees the rendered items.tryLoadCover) is unchanged — it queries the DOM after render.Test plan
/books.htmlto confirm Googlebot sees the rendered list🤖 Generated with Claude Code