Langsung ke konten utama

Numerasi

function fetchPostsByLabels(labels) { labels.forEach(label => { const blogUrl = 'https://elmuweruh.blogspot.com'; // URL blog Anda const postCount = 6; // jumlah maksimal per label const script = document.createElement('script'); script.src = `${blogUrl}/feeds/posts/default/-/${encodeURIComponent(label)}?alt=json-in-script&callback=showCards&max-results=${postCount}`; document.head.appendChild(script); }); } function showCards(json) { const container = document.getElementById('numerasi-cards-container'); const posts = json.feed.entry || []; posts.forEach(post => { const thumbnailUrl = post.media$thumbnail ? post.media$thumbnail.url.replace('/s72-c/', '/s500-c/') : 'https://placehold.co/500x300.png?text=Tidak+Ada+Gambar'; const postUrl = post.link.find(link => link.rel === 'alternate').href; const postTitle = post.title.$t; const postSummary = post.summary ? post.summary.$t.substring(0, 100) + '...' : ''; const cardHTML = ` ${postTitle}
${postTitle}

${postSummary}

`; container.insertAdjacentHTML('beforeend', cardHTML); }); } // 🔹 panggil untuk ambil label "Numerasi" & "Literasi" fetchPostsByLabels(["Numerasi", "Literasi"]);

Komentar