ÚLTIMO MOMENTO
Bandera de Paraguay
PY
Inicio Sucesos Nacionales Economía Deportes Tecnología Archivo
Volver al inicio

Cargando archivo de noticias...

Archivo Especial

Especial Mundial 2026

Colección de noticias, calendario, grupos y sedes de la Copa Mundial FIFA 2026.

Ver noticias del Mundial
Calendario de Partidos Grupos FIFA 2026 Estadios y Sedes
`; // Agrupar tarjetas por Año-Mes (YYYY-MM) const groups = {}; cardsData.forEach(card => { const ym = card.date.substring(0, 7); if (!groups[ym]) groups[ym] = []; groups[ym].push(card); }); const sortedYM = Object.keys(groups).sort((a, b) => b.localeCompare(a)); sortedYM.forEach(ym => { const monthCards = groups[ym]; const monthLabel = getYearMonthLabel(ym); html += `

${escapeHtml(monthLabel)} ${monthCards.length} ${monthCards.length === 1 ? 'edición' : 'ediciones'}

`; monthCards.forEach(({ date, headlines, newsCount }) => { const dayName = getDayName(date); const formattedDate = formatDateShort(date); html += `
${escapeHtml(formattedDate)}
${escapeHtml(dayName)}
    ${headlines.length > 0 ? headlines.map(h => `
  • ${escapeHtml(h)}
  • `).join('') : '
  • Edición disponible
  • '}
`; }); html += `
`; }); container.innerHTML = html; // Trigger fade-in animations fast requestAnimationFrame(() => { document.querySelectorAll('.historial-card.fade-in').forEach((el, i) => { setTimeout(() => el.classList.add('visible'), Math.min(i * 30, 300)); }); }); } // ═══ RENDER EDITION DETAIL (una fecha específica) ═══ async function renderEditionDetail(dateStr) { const container = document.getElementById('historial-content'); const safeDateStr = sanitizeParam(dateStr); try { const res = await fetch(`/historial/${safeDateStr}/news.json`); if (!res.ok) throw new Error('Not found'); const data = await res.json(); // Actualizar meta tags para SEO const formattedDate = formatDateES(safeDateStr); const mainTitle = data.hero && data.hero[0] ? data.hero[0].title : 'Edición del ' + safeDateStr; const pageTitle = `Noticias del ${formattedDate} — Resumen Digital Paraguay`; document.title = pageTitle; document.querySelector('meta[name="description"]')?.setAttribute('content', `Edición del ${formattedDate}: ${mainTitle}. Todas las noticias de Paraguay de este día.`); document.querySelector('meta[property="og:title"]')?.setAttribute('content', pageTitle); document.querySelector('meta[property="og:description"]')?.setAttribute('content', `Edición ${safeDateStr}: ${mainTitle}`); document.querySelector('meta[property="og:url"]')?.setAttribute('content', `https://resumendigital.vercel.app/py/historial/${safeDateStr}`); document.querySelector('link[rel="canonical"]')?.setAttribute('href', `https://resumendigital.vercel.app/py/historial/${safeDateStr}`); // Esperar a que HISTORIAL_FECHAS esté disponible para navegación let retries = 0; while (typeof HISTORIAL_FECHAS === 'undefined' && retries < 20) { await new Promise(r => setTimeout(r, 100)); retries++; } // Encontrar prev/next edition let prevDate = null, nextDate = null; if (typeof HISTORIAL_FECHAS !== 'undefined') { const sorted = [...HISTORIAL_FECHAS].sort((a, b) => a.localeCompare(b)); const idx = sorted.indexOf(safeDateStr); if (idx > 0) prevDate = sorted[idx - 1]; if (idx < sorted.length - 1) nextDate = sorted[idx + 1]; } // Build page let html = `
Edición Histórica

Noticias del ${escapeHtml(formattedDate)}

${countNews(data)} noticias en esta edición

`; // Hero section if (data.hero && data.hero.length > 0) { html += '
'; const getAbsPath = (path) => (path && !path.startsWith('http') && !path.startsWith('/')) ? '/' + path : path; if (data.hero[0]) { html += `
${escapeHtml(data.hero[0].title)}
${escapeHtml(data.hero[0].tag)}

${escapeHtml(data.hero[0].title)}

${escapeHtml(data.hero[0].subtitle)}

${escapeHtml(data.hero[0].time)} ${escapeHtml(data.hero[0].category || '')}
${data.hero[0].slug ? `Leer más ` : ''}
`; } for (let i = 1; i < data.hero.length && i < 3; i++) { html += `
${escapeHtml(data.hero[i].title)}
${escapeHtml(data.hero[i].tag)}

${escapeHtml(data.hero[i].title)}

${escapeHtml(data.hero[i].time)}
${data.hero[i].slug ? `Leer más ` : ''}
`; } html += '
'; } // Quick Summary if (data.quickSummary && data.quickSummary.length > 0) { html += `

Resumen del Día

`; data.quickSummary.forEach(item => { html += `
${escapeHtml(item.number)}

${escapeHtml(item.headline)}

${escapeHtml(item.summary)}

${escapeHtml(item.tag)} ${item.source ? `${escapeHtml(item.source)}· ` : ''} ${escapeHtml(item.time)}
`; }); html += '
'; } // Categories if (data.categories && data.categories.length > 0) { html += `

📂 Por categoría

`; data.categories.forEach(cat => { const getAbsPath = (path) => (path && !path.startsWith('http') && !path.startsWith('/')) ? '/' + path : path; html += `

${escapeHtml(cat.name)}

${cat.main.image ? `
${escapeHtml(cat.main.title)}
` : ''}

${escapeHtml(cat.main.title)}

${escapeHtml(cat.main.excerpt)}

${cat.secondary ? cat.secondary.map(sec => `

${escapeHtml(sec.title)}

${escapeHtml(sec.excerpt)}

`).join('') : ''}
`; }); html += '
'; } // Navigation between editions html += ` `; container.innerHTML = html; // Trigger animations setTimeout(() => { document.querySelectorAll('.fade-in').forEach((el, i) => { setTimeout(() => el.classList.add('visible'), i * 50); }); }, 100); } catch (e) { container.innerHTML = `

Edición no encontrada

No pudimos encontrar la edición del ${escapeHtml(safeDateStr)}.

Ver todas las ediciones
`; } } // ═══ INIT ═══ async function initHistorial() { const params = new URLSearchParams(window.location.search); const fecha = params.get('fecha'); if (fecha) { await renderEditionDetail(fecha); } else { await renderHistorialIndex(); } } if (document.readyState === 'loading') { document.addEventListener('DOMContentLoaded', initHistorial); } else { initHistorial(); } -->