Pass page name as query parameter

ghislaineguerin
Participant

On the attached, I'm trying to replace "restaurants" with {{ content.name }}

so that the generated pages change the content dynamically. How would I go about doing that?

 

{% set queryparams = "" %}
{% set queryparams = queryparams ~ "&hs_name=Restaurants" %}

{% set table = hubdb_table_rows(dynamic_page_hubdb_table_id, queryparams) %}

0 Upvotes
4 Replies 4
Jsum
Key Advisor

@ghislaineguerin,

 

This the variable for content name: {{ content.name }}

 

so you could concatinate this to the end of your string. I'm pretty sure it will ouput with spaces so you might need to filter to format the name, replacing spaces with dashes or however your urls are set up for the pages. 

 

{% set urlend = content.name|whateverfilter() %}

then concatenate "urlend" to the end of your string (outside the quotations). 

 

There might be other variables you can use that reference the url itself as well. check out http://designers.hubspot.com/docs/hubl/hubl-supported-variables

0 Upvotes
ghislaineguerin
Participant

Thank you, I'm going to give this a try and let you know.

0 Upvotes
mwhite
Participant

I'm trying to do the same basically:

 {% set ticketGroup = "{{ dynamic_page_hubdb_row.image1 }}" %}

 

<!--How do I replace 6172F below with the variable {{ ticketGroup}} ?-->

 

{% set queryparams = "" %}
{% set queryparams = queryparams ~ "&image1__contains=6172F" %}

 

Any help is greatly appreciated!

0 Upvotes
mwhite
Participant

I got it!

 

{% set queryparams = "" %}
{% if request.query_dict.formnew %}
{% set queryparams = queryparams ~ "&image1__contains="~request.query_dict.formnew|title|urlencode %}
{% endif %}

{% for row in hubdb_table_rows(dynamic_page_hubdb_table_id, queryparams) %}
<li> {{ row.image1 }} is {{ row.formnew }}</li>

0 Upvotes