CMS Development

jpineda91
投稿者

hubDB resources data not displaying

解決

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 いいね!
1件の承認済みベストアンサー
ashleyidesign
解決策
トップ投稿者 | Solutions Partner
トップ投稿者 | Solutions Partner

hubDB resources data not displaying

解決

I believe where it says 

{{ tag }}

It should instead be 

{{ tag.name }}

元の投稿で解決策を見る

0 いいね!
8件の返信
ashleyidesign
トップ投稿者 | Solutions Partner
トップ投稿者 | Solutions Partner

hubDB resources data not displaying

解決

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
投稿者

hubDB resources data not displaying

解決

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 いいね!
ashleyidesign
トップ投稿者 | Solutions Partner
トップ投稿者 | Solutions Partner

hubDB resources data not displaying

解決

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

0 いいね!
jpineda91
投稿者

hubDB resources data not displaying

解決

@ashleyidesign 

Yes, Here you go link

 

Thanks,

Jonathan

0 いいね!
ashleyidesign
トップ投稿者 | Solutions Partner
トップ投稿者 | Solutions Partner

hubDB resources data not displaying

解決

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 いいね!
jpineda91
投稿者

hubDB resources data not displaying

解決

@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 いいね!
ashleyidesign
解決策
トップ投稿者 | Solutions Partner
トップ投稿者 | Solutions Partner

hubDB resources data not displaying

解決

I believe where it says 

{{ tag }}

It should instead be 

{{ tag.name }}
0 いいね!
jpineda91
投稿者

hubDB resources data not displaying

解決

@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 いいね!