News page added back to website

The News page has been added back to the website. Some news sources were removed as they often produced RSS errors or the headlines were simply too bombastic or misleading by my standards.

On the tech side of it, I did have to add some JavaScript to the native WordPress RSS widgets, so that I links opened in a new tab, etc., below is the code snippet:

<script>
    // Open link in new tab
    let link = document.querySelectorAll('.wp-block-rss__item a')
    link.forEach((e) => {
        e.setAttribute("target", "_blank")
    })

    // Add inline style to the <ul>
    let news_list = document.querySelectorAll("ul.wp-block-rss")
    news_list.forEach((e) => {
        e.setAttribute("style", "list-style-type:none; margin: 1rem auto;");
    })

    // Make the title inline
    let wp_block_rss_item_title = document.querySelectorAll('div.wp-block-rss__item-title')
    wp_block_rss_item_title.forEach((e) => {
        e.setAttribute("style", "display:inline-block!important;");
    })

    // Style the publish date
    let wp_block_rss_item_publish_date = document.querySelectorAll('.wp-block-rss__item-publish-date')
    wp_block_rss_item_publish_date.forEach((e) => {
        e.setAttribute("style", "display:inline-block!important; font-weight:bold; margin:0 8px;")
    })
</script>

Discover more from Jorge Saldívar

Subscribe now to keep reading and get access to the full archive.

Continue reading