// === Product Schema Injection === (function(){ function injectProductSchema(){ if(typeof PRODUCTS === 'undefined') return; // 给当前页面注入 Product Schema 集合 var schema = { "@context": "https://schema.org", "@type": "ItemList", "itemListElement": PRODUCTS.slice(0, 50).map(function(p, i){ return { "@type": "ListItem", "position": i+1, "item": { "@type": "Product", "name": p.name, "image": U + p.img, "description": p.desc, "category": p.cat, "offers": { "@type": "Offer", "priceCurrency": "USD", "availability": "https://schema.org/InStock", "price": p.price ? p.price.split('–')[0].replace(/[^0-9.]/g,'') : "5.00" } } }; }) }; var script = document.createElement('script'); script.type = 'application/ld+json'; script.text = JSON.stringify(schema); document.head.appendChild(script); } if(document.readyState === 'loading'){ document.addEventListener('DOMContentLoaded', injectProductSchema); } else { injectProductSchema(); } })();