As mentioned, I barely know javascript and learnt most of the little I know just building my startpage, so apologies for the poor code.

const parser = new DOMParser();
const proxyUrl = 'https://api.allorigins.win/raw?url='; // To actually use the feed because tumblr is bullshit
const targetUrl = 'https://oneterabyteofkilobyteage.tumblr.com/rss';
const fetchUrl = `${proxyUrl}${encodeURIComponent(targetUrl)}`;

if (document.readyState == 'loading') {
    document.addEventListener('DOMContentLoaded', ready)
} else {
    ready()
}
function ready() {
    let Field = document.getElementsByClassName('RSSData') // To get a simple div (Or rather an array of them)

    fetch(fetchUrl)
        .then(res => res.text()) // Doing the whole promise stuff
        .then(xmlText => {
            const xmlData = parser.parseFromString(xmlText, 'text/xml');
            const items = xmlData.querySelectorAll('item');
            let builtHTML = '';

            items.forEach(function (item) {
                const title = item.querySelector('title')?.textContent || 'No title';
                const link = item.querySelector('link')?.textContent || '#';
                const description = item.querySelector('description')?.textContent || '';
                const pubDate = item.querySelector('pubDate')?.textContent || '';

                builtHTML += `
                <div class="rss-item">
                    <h3><a href="${link}" target="_blank">${title}</a></h3>
                    ${pubDate ? `<small>${pubDate}</small>` : ''}
                    <p>${description}</p>
                </div>` // Pretty self explanatory, appends consecutive elements from each item because of the for-each loop
            })
            return builtHTML;
        })
        .then(builtHTML => {
            Field[0].innerHTML = builtHTML; // Inserts the HTML we just looped through the items to put together inside the div itself.
        })

}
Edit

Pub: 30 Dec 2025 06:56 UTC

Views: 13