mirror of https://github.com/theNewDynamic/gohugo-theme-ananke.git

Patrick Kollitsch
2 days ago c88d2fc98c6b84d847f06b5f1b644d6dadb2299a
refs
author Patrick Kollitsch <83281+davidsneighbour@users.noreply.github.com>
Saturday, June 6, 2026 08:24 +0200
committer GitHub <noreply@github.com>
Saturday, June 6, 2026 08:24 +0200
commitc88d2fc98c6b84d847f06b5f1b644d6dadb2299a
tree 6bf711e24f7087130a3dd4c44d5c2a900da8ce6c tree | zip | gz
parent de31c71c2a3b3235fec0783521d5104ff41ec566 view | diff
fix: allow images in list summary cards (#971)

## Summary

Lets list pages opt in to image summary cards, and makes published dates
consistent across single pages and summary cards.

- Adds an opt-in `params.ananke.pages.show_list_images` switch. When
enabled, list pages render the existing `summary-with-image` card
instead of the plain `summary` card. Default is off, so existing sites
are unchanged.
- Applies the existing `params.ananke.pages.show_date` setting (with the
per-page `ananke.show_date` override) to summary cards so dates display
consistently with single pages.
- Extracts the shared date-visibility logic — previously duplicated in
`single.html` — into a single `layouts/_partials/func/ShowDate.html`
partial used by `single.html`, `summary.html`,
`summary-with-image.html`, and `post/summary.html`.

Closes #217.

## Documentation

Documentation PR: gohugo-ananke/documentation#13

## Scope notes

- Taxonomy term pages (e.g. `/tags/foo/`) are list pages that fall back
to `list.html`, so they pick up image cards from the same switch — no
separate template change needed.
- `summary-with-image` is also used by the home page recent-posts
section, so enabling dates means those cards now show dates by default
(controllable via `show_date`). This is intentional and documented, but
it is a visible default change worth a maintainer's eye before merge.

## Testing

Adds a phase to `scripts/test-hugo-quickstart.ts` that builds a content
section twice:

1. Defaults — asserts no image cards and that dates show.
2. `show_list_images = true` + `show_date = false` — asserts image cards
render and dates are hidden, proving the two settings are independent.

Verified manually that:

- Image cards appear on section lists and taxonomy term lists when
enabled, and never by default.
- Dates show by default and respect `ananke.pages.show_date = false`
plus the per-page `ananke.show_date = true` opt-back-in, on both summary
cards and single pages.
- `single.html` output is unchanged by the partial extraction.
- The new assertions fail if the image switch or the date logic
regresses.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
7 files modified
1 files added
254 ■■■■■ changed files
layouts/_partials/func/ShowDate.html 31 ●●●●● diff | view | raw | blame | history
layouts/list.html 7 ●●●● diff | view | raw | blame | history
layouts/post/list.html 7 ●●●● diff | view | raw | blame | history
layouts/post/summary.html 9 ●●●●● diff | view | raw | blame | history
layouts/single.html 14 ●●●●● diff | view | raw | blame | history
layouts/summary-with-image.html 6 ●●●●● diff | view | raw | blame | history
layouts/summary.html 6 ●●●●● diff | view | raw | blame | history
scripts/test-hugo-quickstart.ts 174 ●●●●● diff | view | raw | blame | history