CMS Development

InboundLead
Member

Using Hubdb to set the topic in a custom blog feed Hubl module

SOLVE

Greetings. We are using a custom Hubl feed module to display blog posts with a tag in tabs. Something like this: 

 

 

<div id="tab-content1" class="tab-content">
{% set topic_posts = blog_recent_topic_posts('all', 'sentencia-incapacidad-invalidez-absoluta', 6) %} 
{% for topic_post in topic_posts %}
<a class="feed-casos-link" target="_blank" href="{{ topic_pt.absolute_url }}">
<div class="feed-casos-container" style="background: url('{{ topic_post.featured_image }}')">
<div class="feed-casos-background">
<div class="feed-casos-text-on">{{ topic_post.name }}</div>
<div class="feed-casos-cta">Ir al caso</div>
<!--<div class="feed-casos-date">el {{ topic_post.updated|datetimeformat('%e/%m/%Y') }} </div>-->
</div>
<div class="feed-casos-overlay">
<div class="feed-casos-text">{{ topic_post.name }}</div>
<div class="feed-casos-cta-on">Ir al caso</div>
</div>
</div>
</a>
{% endfor %}
</div>

Now, we have a dynamic content page using Hubdb and we would like the same custom feed module to display posts from a different topic depending on the url.

 

Question is: is it possible to change the topic dinamically calling a Hubdb row instead in the following statement? (something like '{{ row.topic }}' instead of 'sentencia-incapacidad-invalidez-absoluta' 

{% set topic_posts = blog_recent_topic_posts('all', 'sentencia-incapacidad-invalidez-absoluta', 6) %}

 

{% set topic_posts = blog_recent_topic_posts('all', '{{ row.topic }}', 6) %}

That way, each url set through Hubdb would have a different feed topic indicated in that row.

 

I didn't manage to get it to work so I am not sure if this is possible.

 

Thanks in advance.

0 Upvotes
1 Accepted solution
InboundLead
Solution
Member

Using Hubdb to set the topic in a custom blog feed Hubl module

SOLVE

So I figured out the issue, when trying to call the hubdb row indicated value in the statement, the '' marks were causing it to fail working. It also failed if adding any {{ }} which is, in the end, unnecessary when inside another {{ }} . So I ended up using the following statement:

 

{% set topic_posts = blog_recent_topic_posts('all', dynamic_page_hubdb_row.tag, 6) %} 

Which is now working as I intended.

View solution in original post

2 Replies 2
InboundLead
Solution
Member

Using Hubdb to set the topic in a custom blog feed Hubl module

SOLVE

So I figured out the issue, when trying to call the hubdb row indicated value in the statement, the '' marks were causing it to fail working. It also failed if adding any {{ }} which is, in the end, unnecessary when inside another {{ }} . So I ended up using the following statement:

 

{% set topic_posts = blog_recent_topic_posts('all', dynamic_page_hubdb_row.tag, 6) %} 

Which is now working as I intended.

roisinkirby
HubSpot Product Team
HubSpot Product Team

Using Hubdb to set the topic in a custom blog feed Hubl module

SOLVE

Thank you for sharing the solution with the rest of the community @InboundLead!

0 Upvotes