I am working on editing a part of a custom module for a dynamic page using HubDB. The part I am struggling the most with is creating a "Related Projects" area that should pull content from other rows in the same DB table that has the same tags in one column.
This is the code block that I'm currently using:
{% if showRelatedProjects %}
<div class="{{ module_name }}__related-projects">
<h3>Related Projects</h3>
{% set count = module.related_projects_count %}
{% set allHubDBRows = hubdb_table_rows(dynamic_page_hubdb_table_id) %}
{% for capability in capabilities %}
{% set relatedProjectsQuery = '&limit='~count~'&'~'capability__contains='~capability.name|lower|replace(' ','%20')|replace('&','%26')~'&hs_path__not_like='~path~'&exp_disable=false' %}
{% set resources = hubdb_table_rows(allHubDBRows,relatedProjectsQuery)|rejectattr('disable_project') %}
{% for item in capability %}
{{ project_card(module_name,item) }}
{% endfor %}
{% endfor %}
<a class="cta-link" href="{{ content.absolute_url|replace(dynamic_page_hubdb_row.hs_path,'') }}">
<span class="icon">{{ icon('gallery') }}</span>
<span>View All Projects</span>
</a>
</div>
{% endif %}
This is what renders on the page:
It's pulling the correct module 3 times (one for each tag/capability), however, it's populating only with the content of the current dynamic page. How would I go about so it only shows 2 of the module total and uses information from other rows?