добавил поиск по slug исправил логику подгрузки конкретного товара

This commit is contained in:
Joe_Peach committed 2026-07-28 21:06:00 +03:00
1 parent a585a6a823
commit 090b641906
6 files changed
+54 -31

No files matched your search

+3 -3
View File
@@ -67,7 +67,7 @@ function generateHomePage(products) {
const topProducts = products.slice(0, 6).map(product => `
<div class="product-card">
<h3>${escapeHtml(product.full_name || `Товар ${product.id}`)}</h3>
<a href="/product/${product.id}">Подробнее</a>
<a href="/product/${product.slug || product.id}">Подробнее</a>
</div>`).join('');
return `
@@ -88,7 +88,7 @@ function generateCatalogPage(products) {
<div class="product-card">
<h2>${escapeHtml(product.full_name || `Товар ${product.id}`)}</h2>
<p>${escapeHtml((product.description || '').slice(0, 150))}...</p>
<a href="/product/${product.id}">Подробнее</a>
<a href="/product/${product.slug || product.id}">Подробнее</a>
</div>`).join('');
return `
@@ -139,7 +139,7 @@ const routes = [
// Добавляем страницы товаров
for (const product of products) {
routes.push({
path: `/product/${product.id}`,
path: `/product/${product.slug || product.id}`,
title: product.full_name,
description: (product.description || ''),
getContent: () => generateProductPage(product)