Skip to content

feat: add ready-made liveblog page patterns - #338

Merged
thomasguillot merged 69 commits into
trunkfrom
feat/page-patterns
Nov 27, 2026
Merged

thomasguillot merged 69 commits into
trunkfrom
feat/page-patterns

Conversation

@thomasguillot

@thomasguillot thomasguillot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

Publishers building a liveblog page start from an empty page and assemble the feed, the Live badge, a Follow button and a timer by hand. This adds nine ready-made pages in a "Rolling Coverage - Pages" pattern category: insert one, pick the liveblog, and the page is done.

Builds on #336 (Summary), #337 (Score) and #346 (status badge), all merged. The live pages lead with the Summary, and the Match pages use the Scoreboard with its status line as a badge.

What changes

The block inserter's Patterns tab has a new Rolling Coverage - Pages category, named like the Newspack ones. Each pattern is a whole page built from core blocks and the plugin's blocks, so everything in it can be edited.

With this change:

  • Live page leads with the Summary above a Clock feed. Live page, latest first puts the Live badge and a Get alerts button on one line above every entry in the Stream layout. Live page with side column puts the Live badge above both columns, the feed on the left and, on the right, a box with a short heading, a sentence about alerts and a Get alerts button.
  • Match: scoreboard beside the feed and Match: centered scoreline put the live score next to or above a Minute feed. The scores use the theme's accent colour and the status line ("Full time") shows as a badge, so neither page needs a separate status badge or the ended notice. The centred score splits the page into two equal halves with the dash in the exact middle, whatever the team names' lengths. The side scoreboard shows the status above the teams, has a thin outline in the theme's separator colour and, on the Newspack Block Theme, stays in view while the feed scrolls.
  • The two patterns with a side column put it on the right, using Newspack Blocks' "Move first column to second" Columns style, so on phones it still comes first. Without Newspack Blocks the column sits on the left.
  • Breaking news is an article with the newest update in a bar above the text.
  • Follow page, Follow band and Every live story ask readers to follow one liveblog or several. The Follow band puts the Live badge beside its heading.
  • Inserting a pattern shows the liveblog picker; the Status, Follow, timer and Scoreboard blocks then follow that liveblog by themselves.
  • Those blocks now also work on a page whose only feed shows just the latest entries. On a breakout post, they keep the liveblog the post came from.

A few block and layout changes came out of testing the pages:

  • Coverage Status has a size setting (Styles > Typography). The badge grows with the text; without a size it looks as before.
  • Update Timer has a Ring position setting (Before or After). After keeps the ring still when the timer sits at the end of a row and the countdown changes length.
  • Clock shows the date under an entry's time only for entries from an earlier day, as a date in the site's format instead of "1 month ago". Today's entries show just the time.
  • Summary says when it was last updated the way the Live badge does ("Updated 7 hours ago"), so the two lines read alike. Feeds and Lite Site pages, where nothing can keep that current, keep the clock time.
  • Flash drops the New label: the bar shows one entry at a time, and a new one takes its place. The text now runs up to "See all entries" with no gap.

The patterns appear in the inserter only, not in the new-page "Choose a pattern" window. The docs site has a new Page patterns guide, and the affected docs screenshots are retaken.

The Rolling Coverage - Pages category in the block inserter Live page
Live page, latest first Live page with side column
Match: scoreboard beside the feed Match: centered scoreline
Breaking news Follow page
Follow band Every live story

How to test

  1. Create a page, open the inserter's Patterns tab and select Rolling Coverage - Pages. Nine patterns are listed.
  2. Create another page. The "Choose a pattern" window doesn't list them.
  3. Insert Live page and pick a live liveblog with a Summary and entries from today and earlier days. Publish. The page shows the Live badge and the Summary above the entries. Today's entries show only their time; older ones show the date under it.
  4. Insert Live page, latest first and pick the liveblog. The Live badge and Get alerts sit on one line above the feed, and each entry shows once.
  5. Insert Live page with side column on a page using a wide template (Page (Wide) on the Newspack Block Theme). The Live badge sits above both columns; the alerts box starts level with the feed.
  6. Narrow the window to phone width. The alerts box stacks above the feed.
  7. Deactivate Newspack Blocks and insert the same pattern. The side column is on the left.
  8. Insert Match: scoreboard beside the feed and pick a liveblog with a score. The status badge sits above the teams, the scores use the accent colour and the outline matches the page's separators. On the Newspack Block Theme, scroll: the scoreboard stays in view below the admin bar.
  9. Insert Match: centered scoreline and pick a liveblog with a score. The dash sits in the middle of the page with long and short team names. Change Badge in the liveblog's score row: the open page follows within 30 seconds.
  10. Insert Breaking news and pick a liveblog. The Flash bar shows no New label, and its text runs up to "See all entries".
  11. Insert Follow band and pick a liveblog. The Get alerts button and Live badge follow that liveblog.
  12. Insert Every live story. Each row's Status and Follow ask for a liveblog, set per row.
  13. Insert Breaking news in a post broken out from liveblog A, and pick liveblog B in its bar. Add a Coverage Status block set to Automatic: it shows liveblog A.
  14. Select a Coverage Status block and set a size in Styles > Typography. The badge and the "Updated" text grow together.
  15. Open a liveblog page with a Summary. Its "Updated" line reads like the Live badge's ("Updated 7 hours ago") and keeps counting while the page is open.
  16. Select an Update Timer block and set Ring position to After. The ring moves after the countdown.
  17. Switch to the classic Newspack Theme and insert each pattern. No block shows as invalid.
Technical details
  • Registration: Page_Patterns registers the category and nine patterns on init (priority 11) with filePath, so a pattern file loads only when a pattern is read. No blockTypes or templateTypes, so they stay out of the new-page modal.
  • Why PHP: on trunk a static pattern can't name a built-in layout (layoutId is a site-specific pattern ID). Each pattern embeds its feed's layout as the Rolling Coverage block's inner blocks, filled from Layout_Templates::get_blocks(), the same markup the built-in layout renders. Once layouts can be named by slug, the patterns could reference them instead.
  • Scoreboard markup: Page_Patterns::scoreboard() builds the bound paragraphs in PHP from the theme's presets, mirroring src/blocks/scoreboard/template.ts, the dash included (its class lets the block hide it from screen readers). Classes are kebab-cased as core saves them, so the blocks validate on any theme. On one line each team sits in a group with selfStretch: fixed at 50%, so both halves shrink alike and the dash stays centred. outline sets borderColor: base-3 when the palette has it, else a currentColor border; status_first puts the status above the stacked teams.
  • Theme presets: headings and sizes pick the first preset the theme has, so the classic Newspack Theme gets real sizes. The Match scores take the readable accent through the accent option on Page_Patterns::scoreboard().
  • Match patterns: the Scoreboard sets showStatusAsBadge, and the feeds set archivedNoticeShow: false. The side scoreboard sits in a core Group with position: sticky; its column stretches to the feed's height. Core outputs sticky only on themes with position.sticky (the Block Theme), so on the classic theme it scrolls with the page.
  • Alerts box: a core Group with a 1px border in var(--wp--preset--color--base-3, var(--newspack-theme-color-border, #ddd)), the fallback Every live story uses, so the classic theme gets its own border colour. The Follow button's label group gets margin-inline: auto, which centres it inside an inline-flex theme button at any width.
  • Coverage Status size: typography.fontSize support; style.scss sets newspack-ui's extra-small size on the wrapper and restates the badge's tokens in em, so the badge scales and matches newspack-ui at the default size.
  • Clock's date: a {{date_format}} token, and a render_block_core/post-date filter (mark_earlier_day_entry_date()) that adds data-rc-day and hidden when the entry is from the site's current day (wp_date()). The view re-checks on load, on the 60-second tick and for new entries (earlier-day-dates.ts), using the site's timezone from the frontend config, so cached pages and pages left open past midnight stay right.
  • Summary's "Updated" line: Entry_Bindings::updated_line() renders Coverage Status's strings and <time datetime data-rc-relative> markup, which keepRelativeDatesCurrent() keeps current; applySummaryCard() refreshes a card the poll swaps in. Feeds, Lite Site pages and lite polls keep updated_text()'s clock time (shows_relative_time(), render_with_clock_time()), and the summary cache key separates lite and full. The clock form has its own translator context (time of day).
  • Flash: no New Label block; the rule that keeps a hidden New label's space skips a label right after an excerpt, which stretches to fill the row.
  • Automatic coverage: the order is first full feed, then (on a breakout post) its source entry's coverage, then the first capped feed. It is the same in Page_Coverages::coverage_for_block(), Placements::build() and useBlockCoverage().
  • Side columns: the side column is the first column, so it stacks first on phones without duplicate blocks. Page_Patterns::side_columns_open() adds Newspack Blocks' is-style-first-col-to-second when Newspack_Blocks exists, which shows it second from 782px up.
  • Settled choices: the title width on wide layouts is handled by choosing a wide page template, since a pattern can't change the template's title. Built-in layouts and patterns a site has already saved keep their own copy; Update page patterns and built-in layouts that are already in use #350 covers updating them. Show the date on entries from earlier days in every layout #351 extends the earlier-day date to the other time-only layouts.
  • Docs: site/content/docs/guides/page-patterns.mdx, block READMEs/DEVELOPMENT, CONTRIBUTING. The docs seed builds nine pages from the registered patterns for the screenshots.

Self-review: 18 rounds (Opus 5.5), one blocker fixed.

@thomasguillot

thomasguillot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor Author

Self-review summary: 18 rounds on this branch before handoff. Rounds 1 to 8 ran before the branch was rebased onto trunk after #346, so their commit IDs are from the earlier history.

Accepted:

  • 2aca9ba: the Scoreboard's preset classes are built as core saves them (kebab-case), so a theme slug like ibmPlexSans doesn't make the pattern's blocks invalid; team names take the same size the Scoreboard block gives them.
  • a03d896: pattern headings pick sizes the theme has, so the classic Newspack Theme gets real presets; headings before the first h2 are level 2; the Follow button is built with serialize_block(); Breaking news keeps Flash at text width on purpose, now documented.
  • 006127d: tests for the slug, size and heading handling; two assertions that couldn't fail are gone, and the coverage check walks the parsed blocks.
  • 2055654, 99f9a91: Automatic blocks on a breakout post now prefer the liveblog the post came from over a capped preview of another liveblog, so Follow subscribes readers to the right story.
  • 39a8928, a8d55d5, c2d6563: the docs state that order everywhere, the side-column screenshot label matches the columns, and "standfirst" is reworded.
  • a682865, 3e14380: a trailing space and a docblock wrap.
  • Rounds 4 and 5: no changes. Round 5 read the branch where it meets the restyled Summary and the Scoreboard.
  • Round 6 (after the rebase onto trunk, which added the Scoreboard's dash to the centred Match pattern in 5051005): 086d12e puts the dash one size below the scores on any block theme, gives "Dash" a translator context in both copies of the template, says feed() overrides are for dynamic blocks only, and tidies a docblock and a docs sentence.
  • Round 7 (the "Rolling Coverage - Pages" name and the Newspack Blocks column order in 6150a46): 6a77605 makes the test render both side column patterns with Newspack Blocks present, so it fails if either stops using the column style.
  • Round 8: read 6a77605 without the engine (tests only): the fix as planned, nothing else.
  • Round 9 (whole branch after the rebase, with the Match patterns' Minute feed, status line as a badge, accent scores, outlined sticky side scoreboard, and the Follow page and Follow band spacing): no blockers. 8eec0ad says in the guide that the side score stays in view only on themes with sticky positioning such as the Newspack Block Theme, that "Live page, latest first" needs the liveblog picked in both of its feeds, and names the Scoreboard in the developer doc's capped-feed fallback list.
  • Round 10: read 8eec0ad without the engine (docs and a test docblock): the fixes as planned, nothing else.
  • Round 11 (whole branch after a merge from trunk and the review on a test site: the reworked "Live page, latest first" and side column pages, the Get alerts label, a size setting for Coverage Status, the Update Timer's ring position, the exact Match score split, Flash without the New label, and Clock's date shown only on earlier days): no blockers. 19ed1be stores the full-width Get alerts button the way WordPress 7.1 saves it, so the editor doesn't migrate it on first save, and names the button "Get alerts" in the pattern descriptions. 38c5f8c gives the Ring position labels a translator note, says "at the end of a row" so the help holds on right-to-left sites, tells readers to select the button again to stop alerts (on a phone the button never reads "Stop alerts"), and untangles a sentence in the developer doc's test list.
  • Round 12: the fixes as planned. 1d3bb19 brings the screenshot list's descriptions up to date.
  • Round 13: read 1d3bb19 without the engine (docs only): the fix as planned, nothing else.
  • Round 14 (the side column page reworked: the Live badge above both columns and a box with a heading, a sentence and the Get alerts button beside the feed, replacing the full-width button, the update timer and the spacer): no blockers. 1440b40 drops the "timer" search keyword and a developer-doc mention. 78ff3c5 gives the box the same border fallback as Every live story, so the classic theme draws it in its own border colour, and adds the pattern to the heading tests.
  • Round 15: the fixes as planned.
  • Round 16 (the Match scores a size smaller): no changes.
  • Round 17 (the Summary's "Updated" line in the Live badge's relative style, with clock time kept on feeds and Lite Site): no blockers. 0d74c9e gives the clock form its own translator context, so a language can word "at 3:42 pm" apart from "7 hours ago", and pins a test's language.
  • Round 18: the fix as planned.

Declined:

  • The Follow button's margin-inline: auto looked inert, but the Newspack Block Theme lays buttons out as a flexbox, where it centres the label in a full-width button.
  • Clock's date takes the site's date format when the layout is inserted, like its time, rather than following later changes to Settings, so the editor and server copies stay identical.
  • The pattern's Scoreboard picks heading fonts and sizes slightly differently from the block's editor template when a site gives headings a custom font or a theme has no size presets of its own. Neither happens on the Newspack themes, and the docblock states the intent.
Deferred (not blocking)
  • Dropped: the docs seed could check pattern names and copy placeholders before writing (local screenshot tool, checked by eye); the editor briefly previews the capped feed's liveblog on a breakout post until the source loads; the Follow markup test doesn't bite on English text; the editor's heading font for camelCase theme slugs; small test and style points; one older "liveblog" in a developer doc; a pre-existing difference in how synced and registered patterns are scanned for feeds; no Jest test pins the editor's copy of the Automatic order (the server decides what readers see, and has tests); no test runs the hand-built pattern markup through the editor's block validator (it matches core today, and the check would only guard against future core changes); a stale "ago" where no script runs (REST, AMP), as the Live badge already has; one card swap at midnight on full pages that changes nothing visible; the badge's corner radius doesn't grow with the new size setting (a visual call, and scaling it would override a site's own radius).

@thomasguillot
thomasguillot changed the base branch from feat/scoreboard to trunk November 18, 2026 06:45
thomasguillot and others added 24 commits November 24, 2026 18:29
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
thomasguillot and others added 6 commits November 27, 2026 17:18
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ligned

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…line

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
thomasguillot and others added 15 commits November 27, 2026 18:23
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… column

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ve one

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@thomasguillot
thomasguillot marked this pull request as ready for review November 27, 2026 20:45
@thomasguillot
thomasguillot merged commit bf65222 into trunk Nov 27, 2026
6 checks passed
@github-actions

Copy link
Copy Markdown
Contributor

Hey @thomasguillot, good job getting this PR merged! 🎉

Now, the needs-changelog label has been added to it.

Please check if this PR needs to be included in the "Upcoming Changes" and "Release Notes" doc. If it doesn't, simply remove the label.

If it does, please add an entry to our shared document, with screenshots and testing instructions if applicable, then remove the label.

Thank you! ❤️

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.

2 participants