Tracking URL is conflicting with HubL request.path
SOLVE
I have a directory with content being generated from a HubDB. It uses query parameters for filtering based on categories etc.
Here's the specific code that is conflicted by the tracking url parameters. This is supposed to show a small hero section if there is no query parameter in the URL, or no header and a link back to the Marketplace home if there is one (i.e. if filtering has been applied).
Tracking URL is conflicting with HubL request.path
SOLVE
@piersg it might be a bit easier to manage if you were to set a variable and change that variable with the multiple if statements instead of having a ton of "or"s in a single if statement:
{% set isFilteredView = false %}
{% if request.query_dict.category %}
{% set isFilteredView = true %}
{% endif %}
{% if request.query_dict.another %}
{% set isFilteredView = true %}
{% endif %}
{% if request.query_dict.anotherone %}
{% set isFilteredView = true %}
{% endif %}
{% if request.query_dict.etcetc %}
{% set isFilteredView = true %}
{% endif %}
that way you could have all your logic away from your template/markup.
Tracking URL is conflicting with HubL request.path
SOLVE
@piersg looking for a "?" is a bit too broad of a search especially since if you use any type of CTA to get to that page or social media link it will always have query parameters. What you could instead look for are your specific query parameters like so:
{% if request.query_dict.category or request.query_dict.contact_free %}
this is a filtered hubdb result
{% endif %}
Tracking URL is conflicting with HubL request.path
SOLVE
@piersg it might be a bit easier to manage if you were to set a variable and change that variable with the multiple if statements instead of having a ton of "or"s in a single if statement:
{% set isFilteredView = false %}
{% if request.query_dict.category %}
{% set isFilteredView = true %}
{% endif %}
{% if request.query_dict.another %}
{% set isFilteredView = true %}
{% endif %}
{% if request.query_dict.anotherone %}
{% set isFilteredView = true %}
{% endif %}
{% if request.query_dict.etcetc %}
{% set isFilteredView = true %}
{% endif %}
that way you could have all your logic away from your template/markup.
Jul 2, 202011:02 AM - edited Jul 2, 202011:03 AM
Key Advisor
Tracking URL is conflicting with HubL request.path
SOLVE
I ended up using your second option (but as one long or so it's on fewer lines), as I check for the query a few times in the template.
{% set isFilteredView = false %}
{% if request.query_dict.category or request.query_dict.contact_free or request.query_dict.show or request.query_dict.status or request.query_dict.most_used or request.query_dict.plug_and_play %}
{% set isFilteredView = true %}
{% endif %}
Could equally do it with else if:
{% set isFilteredView = false %}
{% if request.query_dict.category %}
{% set isFilteredView = true %}
{% elif request.query_dict.another %}
{% set isFilteredView = true %}
{% elif request.query_dict.anotherone %}
{% set isFilteredView = true %}
{% elif request.query_dict.etcetc %}
{% set isFilteredView = true %}
{% endif %}
I've implemented the first one for now and I'm double checking that it works (hubspot is being very slow in actually pulling through the template update).
I'll test the second one in staging as well, and then replace after confirming it works 🙂