From c76ed914b15fb09835fa4aea4548992ccfadc851 Mon Sep 17 00:00:00 2001 From: "Carlos (Almeira)" Date: Thu, 26 Mar 2026 15:52:15 -0500 Subject: [PATCH] Fix: Invalid query in slug route and NewsCard footer logic --- src/app/[slug]/page.tsx | 7 ++++++- src/components/NewsCard.tsx | 8 ++++---- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/app/[slug]/page.tsx b/src/app/[slug]/page.tsx index 07a4c8e..a69412b 100644 --- a/src/app/[slug]/page.tsx +++ b/src/app/[slug]/page.tsx @@ -6,6 +6,8 @@ import { Calendar, User, ArrowLeft } from 'lucide-react'; import Link from 'next/link'; async function fetchPostData(slugOrId: string) { + if (!slugOrId || typeof slugOrId !== 'string' || slugOrId.includes('.')) return null; + try { const client = await createAdminClient(); const dbId = APPWRITE_ALMEIRA_CONFIG.databaseId; @@ -25,7 +27,10 @@ async function fetchPostData(slugOrId: string) { return null; } } catch (e) { - console.error("Post detail fetch error", e); + // En desarrollo o por favicon.ico etc, esto puede fallar. Solo logueamos si es error real. + if (!slugOrId.includes('favicon')) { + console.error("Post detail fetch error for slug:", slugOrId, e); + } return null; } } diff --git a/src/components/NewsCard.tsx b/src/components/NewsCard.tsx index 8d935ad..17ae939 100644 --- a/src/components/NewsCard.tsx +++ b/src/components/NewsCard.tsx @@ -24,8 +24,8 @@ export const NewsCard = ({ fecha, imagenUrl, showCategory = false, - showFooterDate = true, - showFooterButton = true, + showFooterDate = false, + showFooterButton = false, footerText }: NewsCardProps) => { // Formatear fecha @@ -74,10 +74,10 @@ export const NewsCard = ({ {fechaFormateada} ) : ( - footerText || "Ver más" + footerText || "" )} - {showFooterButton && ( + {showFooterButton && footerText && (