Skip to content

fix(website): render decorative card titles as div, not h2, to fix Algolia search relevance#2400

Merged
Andriy Knysh (aknysh) merged 3 commits into
mainfrom
osterman/verify-pr-2393-release
May 12, 2026
Merged

fix(website): render decorative card titles as div, not h2, to fix Algolia search relevance#2400
Andriy Knysh (aknysh) merged 3 commits into
mainfrom
osterman/verify-pr-2393-release

Conversation

@osterman
Copy link
Copy Markdown
Member

@osterman Erik Osterman (Cloud Posse) (osterman) commented May 11, 2026

what

  • Swizzle @theme/DocCard so each card's title renders as <div className={styles.cardTitle}> instead of <Heading as=\"h2\">. Visual styling is preserved because the CSS module rule (font-size: 1.2rem) targets the className, not the element.
  • Change ActionCard's <h2>{title}</h2> to <div className=\"action-card__title\">{title}</div> and add explicit font tokens so the title still renders at h2 size.
  • Mirrors the same pattern PR fix(website): single H1 per page for valid Algolia search hierarchy #2393 applied to Terminal, Screengrab, and File.

why

  • Algolia DocSearch v3 indexes any article h2 as a page section (lvl2) — that's the default Docusaurus crawler template's selector. Decorative h2s emitted by these components were being indexed as if they were real headings.
  • On /cli/configuration/auth/ the DocCardList "Related Commands" section emits ten <h2 class=\"cardTitle_*\">📄️ atmos auth login</h2>-style entries. Searches like atmos auth ranked these card titles above the actual /cli/commands/auth/usage page because they contained the literal query.
  • On /cli/commands/auth/usage the ActionCard title <h2>Configure Authentication</h2> sat between the page H1 and the first real H2. That extra heading scrambled the crawler's hierarchy extractor, leaving the page with a single weak type:\"content\" record and no lvl1/lvl2 records — so it couldn't compete with the noisier configuration page.
  • Card titles are navigational labels for a link, not section headings; a <div> is semantically more honest and removes the indexing hijack without forcing an atmos-specific deviation from the DocSearch v3 defaults.

references

  • Builds on fix(website): single H1 per page for valid Algolia search hierarchy #2393 (single-H1-per-page fix for Terminal/Screengrab/File).
  • Verified by querying the live Algolia index at `https://32YOERUX83-dsn.algolia.net/1/indexes/atmos.tools/query\` before and after the build. After the next crawl, the `atmos auth` page should emit proper `lvl1`/`lvl2` records and the configuration page's card list should no longer pollute results.
  • Followup candidates (not in this PR): sweep the remaining decorative-h2 components (`KeyTakeaways`, `KeyPoints`, `NextSteps`, `Card`, `CardGroup`, `Step`, hardcoded `AISection`), and audit the 323 URLs the crawler reported as ignored in the last run.

Summary by CodeRabbit

  • New Features

    • Added a documentation card component that shows docs links or category collections with smart linking and interactive hover behavior.
  • Style

    • Improved action card title styling using a dedicated title class and refined design tokens.
    • Polished documentation card appearance with hover effects, transitions, and updated typography.

Review Change Stack

Algolia DocSearch v3 indexes any <article h2> as a page section (lvl2)
because the default Docusaurus crawler template uses that selector. Two
components on atmos.tools were emitting decorative h2s that hijacked the
search hierarchy:

1. DocCardList items render each card as <h2 class="cardTitle_*">📄️
   {label}</h2>. On pages like /cli/configuration/auth/ this produces
   ~10 lvl2 records containing literal command names ("atmos auth
   login", "atmos auth whoami", ...), which then outrank the real
   command pages on those queries.

2. ActionCard renders <h2>{title}</h2> for its decorative card title.
   On /cli/commands/auth/usage the "Configure Authentication" h2 sits
   between the page H1 and the first real H2, scrambling the crawler's
   hierarchy extractor so the page produces only a single weak
   content-type record.

Both titles are navigational labels for a link, not section headings.
Render them as <div> with the same className so visual styling is
preserved (the CSS targets the class, not the element). Mirrors the
pattern from PR #2393 for Terminal/Screengrab/File.

Swizzles @theme/DocCard rather than changing the Algolia crawler config,
keeping the fix local to atmos.tools and avoiding atmos-specific
deviations from the DocSearch v3 defaults.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@atmos-pro
Copy link
Copy Markdown
Contributor

atmos-pro Bot commented May 11, 2026

Tip

Atmos Pro  

No affected stacks workflow was detected for this pull request.
If this is expected, no action is needed.
Learn More.

@github-actions github-actions Bot added the size/m Medium size PR label May 11, 2026
@osterman Erik Osterman (Cloud Posse) (osterman) added the no-release Do not create a new release (wait for additional code changes) label May 11, 2026
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 11, 2026

Dependency Review

The following issues were found:
  • ✅ 0 vulnerable package(s)
  • ✅ 0 package(s) with incompatible licenses
  • ✅ 0 package(s) with invalid SPDX license definitions
  • ⚠️ 1 package(s) with unknown licenses.
See the Details below.

License Issues

website/package.json

PackageVersionLicenseIssue Type
@docusaurus/plugin-content-docs^3.9.2NullUnknown License
Allowed Licenses: MIT, MIT-0, Apache-2.0, BSD-2-Clause, BSD-2-Clause-Views, BSD-3-Clause, ISC, MPL-2.0, 0BSD, Unlicense, CC0-1.0, CC-BY-3.0, CC-BY-4.0, CC-BY-SA-3.0, Python-2.0, OFL-1.1, LicenseRef-scancode-generic-cla, LicenseRef-scancode-unknown-license-reference, LicenseRef-scancode-unicode, LicenseRef-scancode-google-patent-license-golang
Excluded from license check: pkg:golang/modernc.org/libc

Scanned Files

  • website/package.json

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 11, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: ba3e1fa7-dd34-49bb-9519-79f18dea645e

📥 Commits

Reviewing files that changed from the base of the PR and between 95853c9 and 001606e.

⛔ Files ignored due to path filters (1)
  • website/pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (1)
  • website/package.json

📝 Walkthrough

Walkthrough

Replaces ActionCard title h2 with a div using action-card__title, adds a new DocCard theme component plus its CSS module, and adds @docusaurus/plugin-content-docs to website dependencies.

Changes

ActionCard Title Refactor

Layer / File(s) Summary
Component Markup
website/src/components/ActionCard/index.js
Title element changed from semantic h2 to div with action-card__title class.
CSS Styling
website/src/components/ActionCard/index.css
CSS selector updated from .action-card h2 to .action-card__title with typography variables.

DocCard Theme Component

Layer / File(s) Summary
Card and Typography Styles
website/src/theme/DocCard/styles.module.css
.cardContainer rule with border, shadow, transition, and hover states; .cardTitle and .cardDescription typography classes added.
Component Implementation
website/src/theme/DocCard/index.js
DocCard renders category cards via sidebar link resolution and link cards with internal/external icon detection; includes useCategoryItemsPlural helper and optional doc-derived descriptions.

Dependency

Layer / File(s) Summary
Package Dependency
website/package.json
Added @docusaurus/plugin-content-docs ^3.9.2 to dependencies.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • cloudposse/atmos#1854: Adds ActionCard instances to docs — touches the same ActionCard component and markup.

Suggested labels

no-release

Suggested reviewers

  • aknysh
  • atmos-pro
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: converting decorative h2 elements to divs to improve Algolia search relevance, which aligns with all file changes.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch osterman/verify-pr-2393-release

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

coderabbitai[bot]
coderabbitai Bot previously approved these changes May 11, 2026
atmos-pro[bot]
atmos-pro Bot previously approved these changes May 11, 2026
Copy link
Copy Markdown
Contributor

@atmos-pro atmos-pro Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There were no affected stacks, therefore this is approved by Atmos Pro.

@codecov
Copy link
Copy Markdown

codecov Bot commented May 11, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 78.16%. Comparing base (823ef2e) to head (c9220e2).

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #2400      +/-   ##
==========================================
+ Coverage   78.12%   78.16%   +0.03%     
==========================================
  Files        1098     1098              
  Lines      103630   103630              
==========================================
+ Hits        80966    80999      +33     
+ Misses      18213    18180      -33     
  Partials     4451     4451              
Flag Coverage Δ
unittests 78.16% <ø> (+0.03%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.
see 6 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

…wizzle

The swizzled DocCard component at website/src/theme/DocCard/index.js
imports `@docusaurus/plugin-content-docs/client` for `useDocById` and
`findFirstSidebarItemLink`. The package is a transitive dep of
@docusaurus/preset-classic and was hoisted in local pnpm installs, but
CI's stricter module resolution couldn't find it from outside the
upstream package boundary, failing the build with:

  Module not found: Error: Can't resolve
  '@docusaurus/plugin-content-docs/client' in
  '.../website/src/theme/DocCard'

Adding the package as a direct dependency makes the swizzle resolvable
in any package manager configuration. Version pinned to ^3.9.2 to match
the rest of the @docusaurus/* deps.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Copy link
Copy Markdown
Contributor

@atmos-pro atmos-pro Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There were no affected stacks, therefore this is approved by Atmos Pro.

Copy link
Copy Markdown
Contributor

@atmos-pro atmos-pro Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There were no affected stacks, therefore this is approved by Atmos Pro.

@aknysh Andriy Knysh (aknysh) merged commit 8a3e27b into main May 12, 2026
58 checks passed
@atmos-pro
Copy link
Copy Markdown
Contributor

atmos-pro Bot commented May 12, 2026

Note

Atmos Pro  

Waiting for your GitHub Actions workflow to upload affected stacks.
Learn More.

@aknysh Andriy Knysh (aknysh) deleted the osterman/verify-pr-2393-release branch May 12, 2026 01:01
@github-actions
Copy link
Copy Markdown

These changes were released in v1.218.0-rc.2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

no-release Do not create a new release (wait for additional code changes) size/m Medium size PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants