diff --git a/js/main.js b/js/main.js index f85a510..0c62109 100644 --- a/js/main.js +++ b/js/main.js @@ -729,7 +729,6 @@ function renderWikiCards(data) { return; } - // Sort by updatedAt descending (newest first) const sorted = [...data].sort((a, b) => new Date(b.updatedAt || b.createdAt) - new Date(a.updatedAt || a.createdAt)); sorted.forEach((item, idx) => { @@ -741,4 +740,118 @@ function renderWikiCards(data) { const topic = currentLang === 'en' && item.topic_en ? item.topic_en : (item.topic || 'Unknown'); const topicColor = getTopicColor(topic); - // Get excerpt from first subtopic \ No newline at end of file + const subtopic = currentLang === 'en' && item.subtopic_en ? item.subtopic_en : (item.subtopic || ''); + const content = currentLang === 'en' && item.wiki_en ? item.wiki_en : (item.wiki || ''); + const dateStr = formatDate(new Date(item.updatedAt || item.createdAt)); + const teaser = content.trim().substring(0, 180); + const teaserEnd = content.trim().length > 180 ? '...' : ''; + + const badgeStyle = 'background:' + topicColor.bg + ';color:' + topicColor.text + ';border-left:4px solid ' + topicColor.border; + + card.innerHTML = '' + escapeHtml(topic).toUpperCase() + '' + + '