Hub pages 2/4: {card-group}, {link-card}, and {explore} - #3826
Draft
florent-leborgne wants to merge 1 commit into
Draft
Hub pages 2/4: {card-group}, {link-card}, and {explore}#3826florent-leborgne wants to merge 1 commit into
florent-leborgne wants to merge 1 commit into
Conversation
florent-leborgne
force-pushed
the
feature/hub-card-explore
branch
from
August 11, 2026 07:56
ba2cdd4 to
72fb5a2
Compare
florent-leborgne
force-pushed
the
feature/hub-card-explore
branch
from
August 11, 2026 08:46
72fb5a2 to
b5e2d23
Compare
florent-leborgne
force-pushed
the
feature/hub-card-explore
branch
from
August 11, 2026 13:31
b5e2d23 to
47c33d0
Compare
florent-leborgne
force-pushed
the
feature/hub-card-explore
branch
from
August 11, 2026 15:15
47c33d0 to
a8a4319
Compare
florent-leborgne
force-pushed
the
feature/hub-card-explore
branch
from
August 11, 2026 15:48
a8a4319 to
bc28c12
Compare
These three ship together because {explore} is what switches the other two into
their second rendering mode. A reviewer cannot judge the mechanism from any one
of them alone.
{card-group} is a section heading and a card grid. {link-card} is one card, with
a title, a description, a primary link list, and an optional aside. Its body is a
fixed YAML schema rather than markdown, so a missing title or invalid YAML fails
the build. {explore} wraps card groups into a stack of collapsible accordions.
Nesting drives the mode switch, not an option. Inside {explore} a card group
renders as an accordion and a link card renders as a titled link column, with the
description dropped and the aside rendered as a badge cluster under its own
authored label. Driving this from the ancestor rather than a per-directive option
means every card grid elsewhere on the site keeps working unchanged.
Adds HubDirectiveViewModel, which centralises the attributes a hub link needs.
Hub links come from options and YAML bodies, so they never pass through Markdig's
link renderer and each view was repeating the external, anchor, and preload rules
by hand. {hero} moves onto it too.
The LLM export keeps the whole structure. The curated grouping of links is what a
hub page is for, and the nav tree in llms.txt is neither ordered nor curated, so
it is not a substitute. The search body deliberately gets nothing from these three
directives: section, card, and link titles are the tokens that would let a hub
outrank the pages it links to on a specific query.
Adds doesNotContainHtml to the authoring assertions, for content a directive
drops on purpose.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
florent-leborgne
force-pushed
the
feature/hub-card-explore
branch
from
August 11, 2026 16:51
bc28c12 to
1ba5e1d
Compare
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.
Part 2 of 4, based on #3825. Implements elastic/docs-content-internal#1384 (
{card-group}), #1385 ({link-card}) and #1549 ({explore}).Demo: https://docs-v3-preview.elastic.dev/elastic/docs-builder/pull/3826/examples/products/docs-builder
The three ship together because
{explore}is what switches the other two into their second rendering mode. Split apart, this would add a mode switch nothing can trigger.The mode switch
Nesting decides it. There is no option.
{explore}{card-group}{link-card}Driving this from the ancestor rather than a per-directive option means every card grid elsewhere on the site keeps working unchanged. An author wraps existing groups in
{explore}and the rendering follows.The first accordion in a stack is expanded and the rest are collapsed. Toggling uses native
<details>and<summary>, so it works without JavaScript.Implementation choices
HubDirectiveViewModel. Hub links come from directive options and YAML bodies, so they never reach Markdig's link renderer.{link-card}alone has six anchors, and each view was repeating the external, anchor and preload rules by hand. This centralises them into oneLinkAttributescall.{hero}moves onto it too.Heading levels. An accordion title renders as
<h3>and a column title as<h4>, so an Explore stack keeps a complete outline: sectionh2, accordionh3, columnh4. A<span>would leave the accordion group missing from the page outline.Machine-readable output. The LLM export keeps the whole structure, because the curated grouping of links is what a hub page is for. The search body deliberately gets nothing from these three: section, card and link titles are the tokens that would let a hub outrank the pages it links to.
From the designs
asidelabel keeps the casing the writer chose, for example "Card directives". The prototype forced uppercase.Example page
docs/examples/products/docs-builder.mdgrows from a hero into a full hub, exercising every mode: a standalone highlight grid, a:variant: solutionsgrid with icons and accent variants, and a three-accordion{explore}stack with four columns, inline asides and badge clusters.Its solution cards use
docs-content://cross-links to the published Elastic documentation, which also covers the cross-link form.Testing
./build.sh unit-testpasses.dotnet formatandnpm run fmt:checkare clean. A full docs build reports 0 errors and 0 warnings.tests/authoring/Blocks/Hub/CardsAndExplore.fscovers both rendering modes, thesolutionsvariant, the first-accordion-open rule, the dropped description, the aside label, the heading levels, icon and variant accents, and four failure paths.Screenshots to add or update
None attached. The accordion stack and the two card layouts are worth checking on the preview.