Cards fall back to the section image
Owner:
Ivan Hawkes
references:
be-best/layouts/_partials/images/featured.html
Cards fall back to the section image
A card with no image of its own shows the section’s image.
be-best/layouts/_partials/images/featured-image.html:14 falls back to
.Parent.Page.Resources when the page has no featured.webp. In a listing,
every image-less post therefore renders its section’s image, and the same large
file repeats across the page. All 6 cards on public/post/garden/index.html
render /post/garden/featured_hu_ecf1cdc248bd6b78.jpg: no garden post in that
page carries its own featured.webp. At the 1920w variant the section image
weighs 363 KB, so the page requests 2.2 MB of one picture.
Cards fall back to the section image
- A card selects an image from its own page resources only: the
.Parent.Page.Resourceslookup is off the card path, behind aninheritflag a card does not set. - A card with no image renders text only, with no
<img>, no<picture>and nobigImgDivwrapper: the lookup returns nil and the card writes nothing, not even the empty link that used to wrap the image. - The page-level featured image keeps its inherited-image behaviour,
documented as intended for post pages: the flag defaults to true, and
featured-image.htmldocuments both paths.
Acceptance Criteria
- On
public/post/garden/index.html, each image URL appears at most once, and the number of card images equals the number of cards whose post owns afeatured.webp, 0 on that page today. 12 cards, 0 images. public/post/index.htmlkeeps 6 cards with 6 distinct image URLs. 6 cards (the section holds 6), 6 distinct URLs, each a section’s own image.- No page in
public/repeats the same featured image URL in two cards: 0 pages repeat one. pnpm run testpasses.
Notes
- Fixed with the card redesign of
p2-ft-card-design-improvements, which owns the card path. The lookup ispartial "images/featured.html";featured-image.htmlkeeps the page-hero path withinheritdefaulting to true, and the card partials passinherit false. - The criteria counted 6 cards per listing. Section listings paginate at twelve entries, as the functional specification has always said, and the card redesign moved the four paginated sections from 6 to 12 to match, so the listings named above are measured at 12.