CMS Development

Hubmate
Colaborador

HubL RSS listing - Topic Parameter

resolver

Hi,

 

Is there a supported 'blog topic' parameter for the RSS Listing HubL tag: https://designers.hubspot.com/docs/hubl/hubl-supported-tags#rss-listing It is not listed there. Yet, when you add a drag and drop RSS Listing module, the user gets to choose an optional blog topic.

 

I'm aware of all the available HubL functions i.e. 'blog_recent_topic_posts' but I can't use them because of the 'limit' restrictions.

 

Thanks,

Steve

1 Soluciones aceptada
tjoyce
Solución
Experto reconocido | Partner nivel Elite
Experto reconocido | Partner nivel Elite

HubL RSS listing - Topic Parameter

resolver

Tough question and I'm sure asked many times before. Scoured the documentation and forums and found nothing. Finally, after monitoring the network traffic in the Design Manager after assigning a topic to the RSS feed, I managed to find it. 

{% rss_listing "my_rss_listing" topic_id='5876229575' %}

Now you just have to find the ID of the topic you want to filter

 

topic_id.png


tim@belch.io

Ver la solución en mensaje original publicado

5 Respuestas 5
tjoyce
Solución
Experto reconocido | Partner nivel Elite
Experto reconocido | Partner nivel Elite

HubL RSS listing - Topic Parameter

resolver

Tough question and I'm sure asked many times before. Scoured the documentation and forums and found nothing. Finally, after monitoring the network traffic in the Design Manager after assigning a topic to the RSS feed, I managed to find it. 

{% rss_listing "my_rss_listing" topic_id='5876229575' %}

Now you just have to find the ID of the topic you want to filter

 

topic_id.png


tim@belch.io

Hubmate
Colaborador

HubL RSS listing - Topic Parameter

resolver

Cheers Tim. I actually got the same result (topic_id) but by looking through the developer info instead. Now I'm wondering whether I can loop through the RSS feed so I can filter the results. I don't think that's possible, else Hubspot wouldn't have created all of the Hubl feed functions.

mehdi
Miembro

HubL RSS listing - Topic Parameter

resolver

You cant loop through rss listing. Rss listing module returns html script instead of object array. I wished it returned object array so we could easily loop through and use it the way we want. But if you are fetching your own hubspot blog then you dont need rss listing and you can use blog_recent_posts function.

 

{% set internalFeed = blog_recent_posts(write-id-here, limit=3) | sort(true, false, 'publish_date') %}

<div>
{% for post in internalFeed %}
{% if post.post_list_summary_featured_image || post.post_list_content %}
<span>{{post.absolute_url}}</span>
<span>{{post.post_list_summary_featured_image}}</span>
<span>{{post.blog_post_author.display_name}}</span>
<span>{{post.publish_date|datetimeformat('%d.%m.%Y') }}</span>
<span>{{post.blog_post_author.avatar}}</span>
<span>{{post.post_list_content|safe}}</span>
{% endif %}
{% endfor %}
</div>

 

 

If you want to integrate external rss feeds into hubspot then you will need to setup a CORS (I use azure functions, pretty straightforward) or use third party website (https://rss2json.com). Then loop through the object and parse it and list it.

 

I have done that kind of integration as well (for example listing medium blog posts inside hubspot pages) with some jquery.

 

0 Me gusta
tjoyce
Experto reconocido | Partner nivel Elite
Experto reconocido | Partner nivel Elite

HubL RSS listing - Topic Parameter

resolver

Oh yea, I don't think you can loop that. Perhaps setting up simple php page and calling your own blog feed from the hubl template using jsonp. Something like:

 

PHP

<?php
  header('content-type: application/json; charset=utf-8');
  echo 'customFeed(';
  getFeed();
  echo ')';

function getFeed(){
    $cSession = curl_init();
    curl_setopt($cSession,CURLOPT_URL,"https://api.hubapi.com/content/api/v2/blog-posts?hapikey=my-api-key&limit=100");
    curl_setopt($cSession,CURLOPT_HEADER, false);
    curl_setopt($cSession, CURLOPT_RETURNTRANSFER,1);
    $result = curl_exec($cSession);
    curl_close($cSession);
    echo $result;
}

and then a simple jsonP ajax call:

<script>
$.ajax({url: 'http://localhost:9999', dataType:'jsonp'});
function customFeed(json){
    console.log(json);
}
</script>

tim@belch.io
0 Me gusta
Hubmate
Colaborador

HubL RSS listing - Topic Parameter

resolver

I need to learn PHP 🙂