I created an RSS Feed on my Drupal 8 site.
I display the RSS Feed on my second site, mail the images are not displayed.
Here is the address of my RSS Feed :
https://www.s1biose.com/fr/test/rss.xml
And here is my JS code :
const FEED_URL = `https://www.s1biose.com/fr/test/rss.xml`;fetch(FEED_URL) .then(response => response.text()) .then(str => new window.DOMParser().parseFromString(str, "text/xml")) .then(data => { const items = data.querySelectorAll("item"); let html = ``; items.forEach(el => { html += `<div class="card mb-3 text-start position-relative text-dark" style="max-width: 540px;"><div class="row g-0"><div class="col-md-4"><img src="${el.querySelector("enclosure").innerHTML}" alt="${el.querySelector("title").innerHTML}"></div><div class="col-md-8"><div class="card-body"><div class="card-title h5">${el.querySelector("title").innerHTML}</div><p class="card-text">${el.querySelector("description").innerHTML}</p><p class="card-text"><small class="text-muted">${el.querySelector("pubDate").innerHTML}</small></p></div></div></div><a href="${el.querySelector("link").innerHTML}" title="${el.querySelector("title").innerHTML}" class="stretched-link" target="_blank" rel="noopener noreferrer"></a></div> `; }); document.querySelector('#feed').insertAdjacentHTML("beforeend", html); });
How do I display the images in my RSS Feed with JS ?
You have to go to the bottom of my site to see the RSS Feed :