Repository navigation
feat: pdp product SKU meta tag - #3383
thiagopereira-vtex wants to merge 2 commits into
Conversation
WalkthroughProduct page NextSeo additionalMetaTags now include product:id, product:sku, product:name, product:category (from first breadcrumb), product:url (from meta.canonical), product:brand, and product:condition ('new'); existing price meta tags unchanged. ChangesProduct Page SEO Metadata
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 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 |
|
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. |
There was a problem hiding this comment.
Pull request overview
This PR enriches PDP SEO/head metadata by adding product-identifying <meta property="product:*" ...> tags so external consumers (e.g., Activity Flow tracking) can reliably read SKU/name/category/URL for the currently viewed product.
Changes:
- Adds
product:skuandproduct:namemeta tags sourced fromproduct. - Adds
product:categorymeta tag sourced from the first breadcrumb (when available). - Adds
product:urlmeta tag sourced from the canonical URL (meta.canonical).
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
10233b1 to
7dcf5ac
Compare
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 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.
Inline comments:
In `@packages/cli/CHANGELOG.md`:
- Line 206: Update the changelog entry that begins "Enhance session validation
logic to skip token refresh in local ……" by replacing the double ellipsis
characters (……) with a single ellipsis (…); locate the entry text in the
CHANGELOG content (the line containing "Enhance session validation logic to skip
token refresh in local") and normalize the ellipsis to match the storybook
changelog.
- Line 37: Update the CHANGELOG entry that reads "createNextJSPages throwing
preventing copy of store discovery-co……" to use a single ellipsis character (…)
to match the corresponding entry in packages/storybook/CHANGELOG.md; locate the
line containing that exact text and replace the double ellipsis sequence (……)
with the single ellipsis (…) so formatting is consistent across the monorepo.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 478911dc-fc40-4782-86b9-9b82c2490b42
⛔ Files ignored due to path filters (1)
CHANGELOG.mdis excluded by none and included by none
📒 Files selected for processing (1)
packages/cli/CHANGELOG.md
| ### Bug Fixes | ||
|
|
||
| - createNextJSPages throwing preventing copy of store discovery-co… ([#3356](https://github.com/vtex/faststore/issues/3356)) ([cf318ab](https://github.com/vtex/faststore/commit/cf318abfecf4c6497d40bfe58203acc90b199696)) | ||
| - createNextJSPages throwing preventing copy of store discovery-co…… ([#3356](https://github.com/vtex/faststore/issues/3356)) ([cf318ab](https://github.com/vtex/faststore/commit/cf318abfecf4c6497d40bfe58203acc90b199696)) |
There was a problem hiding this comment.
Ellipsis formatting inconsistency with storybook changelog.
This line uses double ellipsis (……) but the corresponding entry in packages/storybook/CHANGELOG.md uses a single ellipsis (…). For consistency across the monorepo, these should match.
✏️ Suggested fix
-- createNextJSPages throwing preventing copy of store discovery-co…… ([`#3356`](https://github.com/vtex/faststore/issues/3356)) ([cf318ab](https://github.com/vtex/faststore/commit/cf318abfecf4c6497d40bfe58203acc90b199696))
+- createNextJSPages throwing preventing copy of store discovery-co… ([`#3356`](https://github.com/vtex/faststore/issues/3356)) ([cf318ab](https://github.com/vtex/faststore/commit/cf318abfecf4c6497d40bfe58203acc90b199696))📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| - createNextJSPages throwing preventing copy of store discovery-co…… ([#3356](https://github.com/vtex/faststore/issues/3356)) ([cf318ab](https://github.com/vtex/faststore/commit/cf318abfecf4c6497d40bfe58203acc90b199696)) | |
| - createNextJSPages throwing preventing copy of store discovery-co… ([`#3356`](https://github.com/vtex/faststore/issues/3356)) ([cf318ab](https://github.com/vtex/faststore/commit/cf318abfecf4c6497d40bfe58203acc90b199696)) |
🤖 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/cli/CHANGELOG.md` at line 37, Update the CHANGELOG entry that reads
"createNextJSPages throwing preventing copy of store discovery-co……" to use a
single ellipsis character (…) to match the corresponding entry in
packages/storybook/CHANGELOG.md; locate the line containing that exact text and
replace the double ellipsis sequence (……) with the single ellipsis (…) so
formatting is consistent across the monorepo.
| ### Bug Fixes | ||
|
|
||
| - Enhance session validation logic to skip token refresh in local … ([#3285](https://github.com/vtex/faststore/issues/3285)) ([41a330a](https://github.com/vtex/faststore/commit/41a330a9704a29369141e6e78b1f6d01e5a2e1a5)) | ||
| - Enhance session validation logic to skip token refresh in local …… ([#3285](https://github.com/vtex/faststore/issues/3285)) ([41a330a](https://github.com/vtex/faststore/commit/41a330a9704a29369141e6e78b1f6d01e5a2e1a5)) |
There was a problem hiding this comment.
Ellipsis formatting inconsistency with storybook changelog.
This line uses double ellipsis (……) but the corresponding entry in packages/storybook/CHANGELOG.md uses a single ellipsis (…). For consistency across the monorepo, these should match.
✏️ Suggested fix
-- Enhance session validation logic to skip token refresh in local …… ([`#3285`](https://github.com/vtex/faststore/issues/3285)) ([41a330a](https://github.com/vtex/faststore/commit/41a330a9704a29369141e6e78b1f6d01e5a2e1a5))
+- Enhance session validation logic to skip token refresh in local … ([`#3285`](https://github.com/vtex/faststore/issues/3285)) ([41a330a](https://github.com/vtex/faststore/commit/41a330a9704a29369141e6e78b1f6d01e5a2e1a5))📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| - Enhance session validation logic to skip token refresh in local …… ([#3285](https://github.com/vtex/faststore/issues/3285)) ([41a330a](https://github.com/vtex/faststore/commit/41a330a9704a29369141e6e78b1f6d01e5a2e1a5)) | |
| - Enhance session validation logic to skip token refresh in local … ([`#3285`](https://github.com/vtex/faststore/issues/3285)) ([41a330a](https://github.com/vtex/faststore/commit/41a330a9704a29369141e6e78b1f6d01e5a2e1a5)) |
🤖 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/cli/CHANGELOG.md` at line 206, Update the changelog entry that
begins "Enhance session validation logic to skip token refresh in local ……" by
replacing the double ellipsis characters (……) with a single ellipsis (…); locate
the entry text in the CHANGELOG content (the line containing "Enhance session
validation logic to skip token refresh in local") and normalize the ellipsis to
match the storybook changelog.
7dcf5ac to
ed0edfd
Compare
@faststore/api
@faststore/cli
@faststore/components
@faststore/core
@faststore/diagnostics
@faststore/lighthouse
@faststore/sdk
@faststore/ui
commit: |
| }, | ||
| { | ||
| property: 'product:category', | ||
| content: itemListElements[0]?.name ?? undefined, |
7c3dac6 to
f908308
Compare
f908308 to
5217af3
Compare
renatomaurovtex
left a comment
There was a problem hiding this comment.
Clean, focused change. The ?? undefined guard on product:category matches the existing product:price:amount pattern at p.tsx:196, so it type-checks and behaves consistently (an empty breadcrumb just renders a content-less meta, same as the existing price tag). product.sku/product.name/meta.canonical are all reliably present on the PDP. Just two non-blocking notes.
packages/core/src/pages/[slug]/p.tsx
💬 [seo] property= vs Open Graph vocabulary
product:sku, product:name, product:category and product:url aren't part of the standard Open Graph product namespace (which uses product:retailer_item_id for SKU, etc.), so OG/social/shopping-feed consumers will ignore them — only the Activity Flow script that reads them by property will pick them up. That's fine for the stated tracking goal; just flagging that the "Open Graph product consumers" benefit in the description won't actually materialize for these four. If feed/OG consumption is a real goal, product:retailer_item_id would be the standard key for SKU.
💬 [test] No test coverage
A *.browser.test.tsx (or snapshot) asserting the four tags render with the right values — and that product:category is omitted/empty when the breadcrumb list is empty — would lock in the behavior. Not strictly required for a metadata-only addition, but cheap to add given the edge case in the description.
Verdict: Approved with comments
Blocking: none.
Non-blocking (💬):
- The four
product:*keys aren't standard OG product properties; they serve the Activity Flow script, not OG consumers. - Consider a small test for the rendered tags + the empty-breadcrumb case.
Checks to confirm before merge: pnpm lint · build · pnpm turbo run test --filter=@faststore/core.
|
There was a problem hiding this comment.
🧹 Nitpick comments (1)
packages/core/src/pages/[slug]/p.tsx (1)
214-217: ⚡ Quick winRemove redundant nullish coalescing.
The
?? undefinedis redundant here because optional chaining already returnsundefinedwhen the array is empty or the property doesn't exist.♻️ Simplify the expression
{ property: 'product:category', - content: itemListElements[0]?.name ?? undefined, + content: itemListElements[0]?.name, },🤖 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/src/pages/`[slug]/p.tsx around lines 214 - 217, Remove the redundant "?? undefined" for the meta entry where property is 'product:category'; change the value expression to rely on optional chaining only (use itemListElements[0]?.name) so the content is undefined when missing—update the object that currently has property: 'product:category' and content: itemListElements[0]?.name ?? undefined to simply use itemListElements[0]?.name.
🤖 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/src/pages/`[slug]/p.tsx:
- Around line 214-217: Remove the redundant "?? undefined" for the meta entry
where property is 'product:category'; change the value expression to rely on
optional chaining only (use itemListElements[0]?.name) so the content is
undefined when missing—update the object that currently has property:
'product:category' and content: itemListElements[0]?.name ?? undefined to simply
use itemListElements[0]?.name.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: d2598817-f082-4e49-a5df-c1b7d8da5117
📒 Files selected for processing (1)
packages/core/src/pages/[slug]/p.tsx

0 New Issues
0 Fixed Issues
0 Accepted Issues
What's the purpose of this pull request?
This PR enriches the Product Details Page (PDP) metadata by exposing the product's SKU, name, category, and URL as tags. The Activity Flow tracking script reads page metadata to capture the product view event, but without these fields it couldn't reliably associate the event with the exact product the shopper was viewing.
Beyond tracking, this also improves SEO: structured, machine-readable product metadata in the page gives crawlers and social/commerce platforms (Open Graph product consumers, shopping feeds, etc.) clearer signals about what the page represents.
How it works?
On the PDP (
packages/core/src/pages/[slug]/p.tsx), new entries are added to theadditionalMetaTagspassed toNextSeo, alongside the existingproduct:price:amountandproduct:price:currencytags:Data sources:
product:sku→product.skuproduct:name→product.nameproduct:category→itemListElements[0]?.name(the first breadcrumb level, the same source used byProductJsonLd'scategory), guarded with optional chaining since the breadcrumb list can be empty.product:url→meta.canonical(the canonical product URL)These render as
<meta property="product:*" content="..." />tags in the document<head>, making the current product's data available to the Activity Flow script and any other consumer reading the page metadata.How to test it?
<head>and confirm the following tags are present with correct values for the selected product variation:<meta property="product:sku" content="..."><meta property="product:name" content="..."><meta property="product:category" content="..."><meta property="product:url" content="...">product:categorytag is simply omitted).product viewevent is captured with the correct SKU, name, category, and URL data.Starters Deploy Preview
References
Checklist
You may erase this after checking them all 😉
PR Title and Commit Messages
feat,fix,chore,docs,style,refactor,ciandtestPR Description
breaking change,bug,contributing,performance,documentation..Dependencies
pnpm-lock.yamlfile when there were changes to the packagesDocumentation
@Mariana-Caetanoto review and update (Or submit a doc request)Summary by CodeRabbit