RSS Listing - Open in a new tab


#1

Hi there,

I am trying to edit the default RSS listing module in order to open links in a new tab. However, the module does not seem to read raw HTML so I am unable to add "target="_blank" in. I wondered if there is a way I can set this as an additional field.

Please see the code below.

{% rss_listing
publish_date_text="{{ module.publish_date_text }}",
rss_url="{{ module.rss_url }}",
is_external="{{ is_external }}",
click_through_text="{{ module.click_through_text }}",
show_date="{{ module.show_date }}",
content_group_id="{{ module.content_group_id }}",
include_featured_image="{{ module.include_featured_image }}",
publish_date_format="{{ module.publish_date_format }}",
show_detail="{{ module.show_detail }}",
show_author="{{ module.show_author }}",
number_of_items="{{ module.number_of_items }}",
title="{{ module.title }}",
limit_to_chars="{{ module.limit_to_chars }}",
attribution_text="{{ module.attribution_text }}",
topic_id="{{ module.topic_id }}"
%}

Could someone help me with this?

Thanks!


#2

Hey @Francesco_Brizzo, there's not a built in function for the default RSS module to open in a new tab, but you could always clone the default module and manipulate it a little, possibly to fire some Jquery when a toggle is turned on or off. However, since our RSS modules load async, we will need to use a callback to wait for the RSS feed to load in first. There's a built in function you can use called hsRssFeedComplete(). Your code could look something like this:

function hsRssFeedComplete(){
    $(".hs-rss-module").attr("target", "_blank");
}

#3

Hey @Connor_Barley, thank you very much for this.
This is super Helpful.

Many Thanks,
Francesco