Repository navigation
fix(core): add twitter card meta tag to store pages - #3425
Conversation
|
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
WalkthroughThe SEO configuration now defines a ChangesTwitter SEO metadata
Estimated code review effort: 1 (Trivial) | ~5 minutes Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
packages/core/cypress/integration/seo.test.js (1)
50-50: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winExtend coverage to every changed SEO path.
This test checks only
pages.home, while the PR changes the landing page, product listing page, product page, and both search SEO branches. Add the same assertion to the existing product, collection, filtered collection, and search tests. Add a landing-page test when a landing fixture is available.This prevents a route-specific Twitter metadata regression from passing CI.
Also applies to: 72-76
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/core/cypress/integration/seo.test.js` at line 50, Extend the SEO metadata assertions from the existing pages.home test to the product, collection, filtered collection, and both search test paths, and add a landing-page case when a landing fixture exists. Reuse the current OpenGraph/Twitter assertion and each test’s existing route or fixture setup without changing unrelated coverage.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@packages/core/cypress/integration/seo.test.js`:
- Line 50: Extend the SEO metadata assertions from the existing pages.home test
to the product, collection, filtered collection, and both search test paths, and
add a landing-page case when a landing fixture exists. Reuse the current
OpenGraph/Twitter assertion and each test’s existing route or fixture setup
without changing unrelated coverage.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 53ec5b8a-d0f3-4672-9635-89b26b1479f1
📒 Files selected for processing (7)
packages/core/cypress/integration/seo.test.jspackages/core/src/components/templates/LandingPage/LandingPage.tsxpackages/core/src/components/templates/ProductListingPage/ProductListingPage.tsxpackages/core/src/pages/[slug]/p.tsxpackages/core/src/pages/index.tsxpackages/core/src/pages/s.tsxpackages/ui/src/styles/base/utilities.scss
renatomaurovtex
left a comment
There was a problem hiding this comment.
Thanks for the contribution! The goal is right — twitter:card is genuinely missing and summary_large_image with OG fallback is the correct choice. A few things before merge:
PR title
🟠 ⚡ [conventions] Scope metaTags will fail the "Lint PR" check
Actions haven't run yet on this PR (first-time contributor, workflows pending approval), but Lint PR validates the title against a fixed scope list (core|ui|api|components|sdk|lighthouse|diagnostics|deps|deps-dev) — metaTags isn't in it, so the check will fail as soon as workflows are approved. Rename to:
fix(core): add twitter card meta tag to store pages
Approach — packages/core/src/pages/_app.tsx already renders <DefaultSeo />
🟡 ⚡ [simplification] Set the twitter card once in next-seo.config.ts instead of 6 hardcoded copies
_app.tsx renders <DefaultSeo {...SEO} /> from packages/core/next-seo.config.ts. Adding the twitter config there applies it to every page (next-seo dedupes by key, so any page-level NextSeo that sets twitter still wins):
const config: DefaultSeoProps = {
norobots: storeConfig.experimental.noRobots,
dangerouslySetAllPagesToNoFollow: storeConfig.experimental.nofollow,
dangerouslySetAllPagesToNoIndex: storeConfig.experimental.noindex,
+ twitter: {
+ cardType: 'summary_large_image',
+ },
additionalMetaTags: [This replaces all six per-page additions and also covers the NextSeo pages this PR misses (404.tsx, 500.tsx, login.tsx, checkout.tsx, the pvt/account/* pages) plus any future page for free. As written, a link to a 404/login page shared on X still gets a plain-text preview.
packages/ui/src/styles/base/utilities.scss
🟡 ⚡ [hygiene] Unrelated whitespace reformat — does this need to be in this diff?
The include-media breakpoints re-indent has nothing to do with meta tags and touches a second published package (@faststore/ui) for a no-op. Looks like editor auto-format — please revert so the diff stays scoped to what the title says.
packages/core/cypress/integration/seo.test.js
🟡 [tests] Assertion only added to the Home suite
The PR changes PDP, PLP/collection and search pages too, and this file already has has OpenGraph tags tests for Product Page Seo, Collection Page Seo, Filtered Collection Page Seo and Search Page Seo. Add the same twitter:card assertion to those suites (it's the same 5 lines) — especially if you keep the per-page approach, since each page then has its own code path to regress.
💬 Forward-looking: at some point stores may want to override the card type (or set site/handle) via discovery.config SEO settings, like settings.seo already flows into title/description. Not needed now — the hardcoded default is sensible.
Verdict: Approved with comments
Blocking (🟠):
- PR title scope
metaTags→ usefix(core):(Lint PR check will reject it once workflows are approved)
Non-blocking (🟡/💬):
- Centralize in
next-seo.config.tsviaDefaultSeoinstead of 6 per-page copies (also fixes the pages this PR misses) - Revert the unrelated
utilities.scssreformat in@faststore/ui - Extend the
twitter:cardassertion to the PDP/Collection/Search Cypress suites - CMS/store-config override as a future follow-up
Checks to confirm before merge: workflows approved + Lint PR green · pnpm lint · build · Cypress SEO suite · pnpm size (touches core; drops to core-only if the ui scss change is reverted)
3967b4c to
9c2439b
Compare
eduardoformiga
left a comment
There was a problem hiding this comment.
Thanks for addressing the earlier feedback — title, next-seo.config.ts, Cypress coverage, and the unrelated SCSS cleanup all look good.
Nit: residual duplication
twitter.cardType: 'summary_large_image' is now correctly set once in next-seo.config.ts (via <DefaultSeo /> in _app.tsx), but the same block is still hardcoded on the page-level <NextSeo /> calls:
pages/index.tsxpages/[slug]/p.tsxpages/s.tsx(both branches)LandingPage.tsxProductListingPage.tsx
Since the value is identical everywhere, the per-page copies are redundant — next-seo dedupes by meta key, so the HTML outcome is the same either way. Prefer keeping only the default config; that also covers pages this PR doesn't touch (404, login, checkout, etc.) without maintaining N copies.
Not blocking — happy to approve as-is if you'd rather ship and clean this up in a follow-up.
|

0 New Issues
0 Fixed Issues
0 Accepted Issues
No data about coverage (29.30% Estimated after merge)
What's the purpose of this pull request?
Improve social media sharing previews on Twitter/X by adding the missing
twitter:cardmeta tag across store pages. Without it, shared links default to plain text previews; addingsummary_large_imageensures rich media cards with prominent visual assets.How it works?
We configured the
twitterprop inside the<NextSeo/>component to automatically inject the<meta name="twitter:card" content="summary_large_image" />tag into the HTML<head>.Why is this meta tag important?
OpenGraphfallback assets (og:title,og:description,og:image) when shared on X.Additionally, we updated Cypress E2E tests (
meta[name="twitter:card"]) to assert that the tag is rendered correctly during hydration.How to test it?
<head>section of the HTML.<meta name="twitter:card" content="summary_large_image">exists.pnpm test:e2eor your store's test command) and confirm the SEO suite passes.Starters Deploy Preview
References
Checklist
feat,fix,chore,docs,style,refactor,ciandtestbreaking change,bug,contributing,performance,documentation..pnpm-lock.yamlfile when there were changes to the packagesSummary by CodeRabbit
summary_large_imageformat across key pages.