Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/app/search/SearchResultsClient.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ function formatPrice(price: number | null, currency: string) {

function hasUsableProductImage(value?: string | null) {
if (!value) return false;
if (value.startsWith('data:')) return false;

try {
const imageUrl = new URL(value);
Expand Down
11 changes: 1 addition & 10 deletions src/components/seo/SeoLandingPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,7 @@ function ProductGridCard({ product }: { product: LandingProduct }) {
className="group flex h-full flex-col overflow-hidden rounded-[28px] border border-slate-200 bg-white shadow-sm transition-all duration-200 hover:-translate-y-1 hover:border-amber-200 hover:shadow-xl"
>
<div className="relative aspect-[4/3] overflow-hidden bg-[radial-gradient(circle_at_top,_rgba(251,191,36,0.25),_rgba(248,250,252,0.92)_55%,_rgba(226,232,240,0.95))]">
{product.imageUrl?.startsWith("data:image/svg+xml") ? (
<Image
src={product.imageUrl}
alt={product.name}
fill
sizes="(max-width: 768px) 100vw, (max-width: 1280px) 50vw, 25vw"
unoptimized
className="object-cover transition-transform duration-300 group-hover:scale-[1.03]"
/>
) : product.imageUrl ? (
{product.imageUrl ? (
<Image
src={product.imageUrl}
alt={product.name}
Expand Down
6 changes: 3 additions & 3 deletions src/lib/seo-landing-pages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ function normalizeProduct(item: SearchApiItem, fallbackCurrency: string, minPric

function isUsableProductImage(imageUrl?: string | null) {
if (!imageUrl) return false;
if (imageUrl.startsWith("data:image/svg+xml")) return true;
if (imageUrl.startsWith("data:image/svg+xml")) return false;

try {
const url = new URL(imageUrl);
Expand Down Expand Up @@ -232,7 +232,7 @@ function buildCategoryImage(product: LandingProduct) {

function withFallbackImage(product: LandingProduct): LandingProduct {
if (product.imageUrl) return product;
return { ...product, imageUrl: buildCategoryImage(product) };
return { ...product, imageUrl: null };
}

export async function getSeoLandingProducts(config: SeoLandingPageConfig): Promise<LandingProduct[]> {
Expand Down Expand Up @@ -441,7 +441,7 @@ export function buildSeoLandingSchema(config: SeoLandingPageConfig, products: La
name: product.brand,
}
: undefined,
image: product.imageUrl || undefined,
image: product.imageUrl && !product.imageUrl.startsWith("data:image/svg+xml") ? product.imageUrl : undefined,
category: product.category || undefined,
offers:
product.price !== null
Expand Down