feat: Refactor product catalog output to dynamically generate page links and improve readability of available products
This commit is contained in:
@@ -60,32 +60,19 @@ GrowHeads.de is a German online shop and local store in Dresden specializing in
|
||||
|
||||
if (totalPages > 1) {
|
||||
llmsTxt += `
|
||||
- **Product Catalog**: ${totalPages} pages available
|
||||
- **Page 1**: ${baseUrl}/llms-${categorySlug}-page-1.txt (Products 1-${Math.min(productsPerPage, productCount)})`;
|
||||
|
||||
if (totalPages > 2) {
|
||||
${totalPages} pages available`;
|
||||
for (let p = 1; p <= totalPages; p++) {
|
||||
const start = (p - 1) * productsPerPage + 1;
|
||||
const end = Math.min(p * productsPerPage, productCount);
|
||||
llmsTxt += `
|
||||
- **Page 2**: ${baseUrl}/llms-${categorySlug}-page-2.txt (Products ${productsPerPage + 1}-${Math.min(productsPerPage * 2, productCount)})`;
|
||||
- **Page ${p}**: ${baseUrl}/llms-${categorySlug}-page-${p}.txt (Products ${start}-${end})`;
|
||||
}
|
||||
|
||||
if (totalPages > 3) {
|
||||
llmsTxt += `
|
||||
- **...**: Additional pages available`;
|
||||
}
|
||||
|
||||
if (totalPages > 2) {
|
||||
llmsTxt += `
|
||||
- **Page ${totalPages}**: ${baseUrl}/llms-${categorySlug}-page-${totalPages}.txt (Products ${((totalPages - 1) * productsPerPage) + 1}-${productCount})`;
|
||||
}
|
||||
|
||||
llmsTxt += `
|
||||
- **Access Pattern**: Replace "page-X" with desired page number (1-${totalPages})`;
|
||||
} else if (productCount > 0) {
|
||||
llmsTxt += `
|
||||
- **Product Catalog**: ${baseUrl}/llms-${categorySlug}-page-1.txt`;
|
||||
${baseUrl}/llms-${categorySlug}-page-1.txt`;
|
||||
} else {
|
||||
llmsTxt += `
|
||||
- **Product Catalog**: No products available`;
|
||||
No products available`;
|
||||
}
|
||||
|
||||
llmsTxt += `
|
||||
|
||||
Reference in New Issue
Block a user