Repository navigation
Render product structured data from the theme - #88
Merged
Merged
Conversation
Product pages override the seo block with partials/product_structured_data.html: ProductGroup with per-variant Product and Offer, brand/gtin/mpn from product metadata, UPC as GTIN only when it has a valid length, the displayed price, and every JSON-LD string escaped with escapejs so a quote in a title no longer breaks the markup.
Google's merchant listings test rejects a ProductGroup variant without an image.
Code Review SummaryStatus: 3 Issues Found | Recommendation: Address before merge Overview
Issue Details (click to expand)WARNING
SUGGESTION
Files Reviewed (3 files)
Fix these issues in Kilo Cloud Previous Review Summary (commit 85109bd)Current summary above is authoritative. Previous snapshots are kept for context only. Previous review (commit 85109bd)Status: 15 Issues Found | Recommendation: Address before merge Overview
Issue Details (click to expand)WARNING
SUGGESTION
Files Reviewed (4 files)
Reviewed by minimax-m3 · Input: 93.4K · Output: 4.2K · Cached: 557.8K |
Omit offers when a product or variant has no price record and omit image when neither the product nor the store has one. Cap the image list at three, escape the UPC like every other string, and correct og:type and product:availability to their defined values.
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.
Product pages now render their own meta tags, Open Graph tags and schema.org JSON-LD from
partials/product_structured_data.html, instead of the platform{% seo %}output.ProductGroupwith oneProductandOfferper variant: price, currency, availability, SKU, GTIN, image and description.brand,gtinandmpnwhen the store defines them. Withoutbrandthe store name is used. The UPC is used as the GTIN only when it is 8, 12, 13 or 14 digits, and is no longer emitted asmpn.escapejs, so line breaks, quotes and backslashes in product text produce valid JSON. The platform markup is invalid JSON for any multi-line description.Documented in
docs/pdp-customization.md, "Structured data".Verification
make dtl,make test,make contractandmake css-checkpass;assets/main.cssis unchanged."and</script>, a description with a line break and backslash, products with and without variants, images, descriptions and a valid UPC:json.loadssucceeds in every case and</script>stays inside the JSON string.shippingDetailsandhasMerchantReturnPolicy.Closes #87