CMS Development

jpineda91
Contributeur

hubDB resources data not displaying

Résolue

Hello,

 

I'm fairly new to Hubspot and was trying to implement this hubDB resources library, but after adding the module and the CSS the data does not display on the page template. Any help will be appreciated.

 

thanks,

0 Votes
1 Solution acceptée
ashleyidesign
Solution
Contributeur de premier rang | Partenaire solutions
Contributeur de premier rang | Partenaire solutions

hubDB resources data not displaying

Résolue

I believe where it says 

{{ tag }}

It should instead be 

{{ tag.name }}

Voir la solution dans l'envoi d'origine

0 Votes
8 Réponses
ashleyidesign
Contributeur de premier rang | Partenaire solutions
Contributeur de premier rang | Partenaire solutions

hubDB resources data not displaying

Résolue

Hey there,

 

I would make sure you've 1 - published the HubSpot database and 2 - on the page itself, make sure you've selected which HubSpot database to use. Pictures of what you have so far would be helpful.

 

Cheers,

 

- Ashley

www.ashleyidesign.com

jpineda91
Contributeur

hubDB resources data not displaying

Résolue

Hi @ashleyidesign  Ashley,

Thanks for replying, I decided to go a different route and coded something more simple.

So far, I got the data with some bugs; the <a> on line 32 does not expand to the full height of the <div>:

 

code-bug.png

 

<div class="resource-cards-module">
  {% if module.show_filters %}
  <div class="filters">
    <div class="filter-by-type">
      <select name="topic">
        <option>View Resources By Type</option>
        {% set resource_content_type = hubdb_table_rows(module.hubdbtable_field) %}
        {% for content_type in resource_content_type|map(attribute='content_type') %}
        <option>{{ content_type.name }}</option>
        {% endfor %}
      </select>
    </div>
    <div class="filter-by-topic">
      <select name="topic">
        <option>View Resources By Topic</option>
        {% set resource_tags = hubdb_table_rows(module.hubdbtable_field) %}
        {% for tag in resource_tags|map(attribute='topics') %}
        <option>{{ tag }}</option>
        {% endfor %}
      </select>
    </div>
    <div class="search-articles">
      {% icon name="search" style="SOLID" %}
      <input type="text" name="search" placeholder="Search Resources" value="" />
    </div>
  </div>
  {% endif %}
  {% if module.headline %}<h2 class="text-center light">{{ module.headline }}</h2>{% endif %}
  <div class="grid">
    {% for row in hubdb_table_rows(module.hubdbtable_field,'&limit='~module.limit) %}
    <div class="grid-item">
      <a href="{{ row.link }}" class="item-link"></a>
      <div class="item-image-wrapper"><div class="item-image" style="background-image: url('{{ row.featured_image.url }}');">
        <span>{{row.type.name}}</span>
      </div></div>
      <div class="item-content">
        <h3>{{ row.name }}</h3>
        {{ row.description|truncatehtml(150) }}
        <hr />
        {% if row.content_type %}
        <div class="resource-topics">
          {% for tag in row.content_type|split(',') %}
            <a class="resource-topic-link" href="{{module.resources_page_link.url.href}}?topic={{tag}}">{{ tag }}</a>{% if not loop.last %},{% endif %}
          {% endfor %}
        </div>
        {% endif %}
      </div>
    </div>
    {% endfor %}
  </div>
</div>

 

Any input will be appreciated!

Thanks,
Jonathan





 

0 Votes
ashleyidesign
Contributeur de premier rang | Partenaire solutions
Contributeur de premier rang | Partenaire solutions

hubDB resources data not displaying

Résolue

@jpineda91 Do you have this on a test page you can share the link for?

0 Votes
jpineda91
Contributeur

hubDB resources data not displaying

Résolue

@ashleyidesign 

Yes, Here you go link

 

Thanks,

Jonathan

0 Votes
ashleyidesign
Contributeur de premier rang | Partenaire solutions
Contributeur de premier rang | Partenaire solutions

hubDB resources data not displaying

Résolue

You have a lot of links in that code. For starters, there's no content inside the link on line 32, so nothing is going to be clickable to go to that link. I would suggest cleaning up any links that are irrelevant, especially if you just want one link for each resource item.

 

Feel free to email me with other questions: ashley at ashleyidesign.com

0 Votes
jpineda91
Contributeur

hubDB resources data not displaying

Résolue

@ashleyidesign Thanks for the feedback, I will update the <a>.
Do you know why the content_type is displaying like that? (line 41)

{ID=4, NAME='ANALYST REPORTS', ORDER=0}

 

0 Votes
ashleyidesign
Solution
Contributeur de premier rang | Partenaire solutions
Contributeur de premier rang | Partenaire solutions

hubDB resources data not displaying

Résolue

I believe where it says 

{{ tag }}

It should instead be 

{{ tag.name }}
0 Votes
jpineda91
Contributeur

hubDB resources data not displaying

Résolue

@ashleyidesign Thanks for your help, I got the tags to display properly.
I'm now working on the filters, but have some questions

<select name="topic">
  <option value="">View Resources By Type</option>
  {% for content_type in resource_content_type|map(attribute='content_type') %}
  {% set resource_content_type = hubdb_table_rows(module.hubdbtable_field) %}
  <option>{{ content_type.name }}</option>
  {% endfor %}
</select>
<script>
  jQuery('select[name=topic').on('change',function(){
    let topic = jQuery(this).val();
     if(topic !='') {
       document.location.href='{{ node.url }}/?topic='+topic;
     }   
  });
</script>

Above is my code for the content_type, but I'm not sure how to set the URL path. Any help will be appreciated.

0 Votes