(function() { var script = document.currentScript; var apiUrl = script.getAttribute('data-api-url'); var container = script.parentElement; if(!apiUrl || !container) { console.error('API URL is missing or container element not found.'); return; } fetch(apiUrl) .then(response => response.text()) .then(html => { container.innerHTML = html; }) .catch(error => { console.error('Error fetching latest posts:', error); container.innerHTML = '
Unable to load latest posts.
'; }); })();