La fonction de suggestion automatique permet d'affiner rapidement votre recherche en suggérant des correspondances possibles au fur et à mesure de la frappe.
In order to display them on the blog post list page, I store the list of all the blog ids registered in hubdb in an array, and use "content_by_ids" to get the content of the corresponding ids. However, since the number of blog posts exceeds 100 and the maximum number of posts that can be retrieved by content_by_ids is 100, I am having trouble retrieving all posts. I'm trying to get the target id from HubDB and get the content as follows, but is there a good way to get more than 101 articles?
{% set dbRows = hubdb_table_rows(3410151) %}
{% set post_ids = [] %}
{% for row in dbRows %}
{% do post_ids.append(row.post_id) %}
{% endfor %}
{% set find_contents = content_by_ids(post_ids) %}
{% set page_count = (find_contents|length / post_count_per_page)|round(0, 'floor') %}
{% if find_contents|length % post_count_per_page > 0 %}
{% set page_count = page_count + 1 %}
{% endif %}
Contributeur de premier rang | Partenaire solutions Elite
How to get a list of 100+ blog ids
Résolue
I would add an offset and a limit to your dbrows, call it a number of times and append them together to recreate your loop. I should note, I've not tested this code, but in theory this should still have limit of 300 (up to 500 before you start hitting hubspot call limits if you add a couple more loops), but it will at least boost you from 100 if you have to do it this way.
For example:
{% set dbRows = hubdb_table_rows(3410151, "&limit=100") %}
{% set dbRows2 = hubdb_table_rows(3410151, "&offset=100&limit=100") %}
{% set dbRows3 = hubdb_table_rows(3410151, "&offset=200&limit=100") %}
{% set post_ids = [] %}
{% set post_ids2 = [] %}
{% set post_ids3 = [] %}
{% for row in dbRows %}
{% do post_ids.append(row.post_id) %}
{% endfor %}
{% for row in dbRows2 %}
{% do post_ids2.append(row.post_id) %}
{% endfor %}
{% for row in dbRows3 %}
{% do post_ids3.append(row.post_id) %}
{% endfor %}
{% set find_contents = content_by_ids(post_ids) + content_by_ids(post_ids2) + content_by_ids(post_ids3) %}
Contributeur de premier rang | Partenaire solutions Elite
How to get a list of 100+ blog ids
Résolue
I would add an offset and a limit to your dbrows, call it a number of times and append them together to recreate your loop. I should note, I've not tested this code, but in theory this should still have limit of 300 (up to 500 before you start hitting hubspot call limits if you add a couple more loops), but it will at least boost you from 100 if you have to do it this way.
For example:
{% set dbRows = hubdb_table_rows(3410151, "&limit=100") %}
{% set dbRows2 = hubdb_table_rows(3410151, "&offset=100&limit=100") %}
{% set dbRows3 = hubdb_table_rows(3410151, "&offset=200&limit=100") %}
{% set post_ids = [] %}
{% set post_ids2 = [] %}
{% set post_ids3 = [] %}
{% for row in dbRows %}
{% do post_ids.append(row.post_id) %}
{% endfor %}
{% for row in dbRows2 %}
{% do post_ids2.append(row.post_id) %}
{% endfor %}
{% for row in dbRows3 %}
{% do post_ids3.append(row.post_id) %}
{% endfor %}
{% set find_contents = content_by_ids(post_ids) + content_by_ids(post_ids2) + content_by_ids(post_ids3) %}