CMS Development

phuggett
Member

Using a HubL variable in an Advanced Menu

SOLVE

Hi all,

 

I'm trying to change the page title of a page for each visitor based on a parameter I pass in the URL.

 

Example

Default:

Default Title: Hello World!

 

User 1:

Parameter in URL: ?title=This+is+a+better+title

Title that displays on page: This is a better title

 

User 2:

Parameter in URL: ?title=Different+title

Title that displays on page: Different title

 

Is there a way to use HubL to record the parameter in the URL and then pass it back through as dyamic content on the page?

 

I've had a look through the HubL variables and can't seem to find a free text variable that would suit my needs as they all seem fairly set.

 

If you know of any other routes to achieving the same outsome it would be great.

 

Already Investigated

I've already investigated using SMART content for, this however the contact properties only update on some type of submission e.g. form (even when using hidden fields) so it makes using SMART content driven by custom contact lists a non-starter. I've also consider using SMART content by referring URL but it doesn't allow creation of specific deep URLs for matching.

 

Many thanks in advance for any help.

Paul

 

0 Upvotes
2 Accepted solutions
ndwilliams3
Solution
Key Advisor

Using a HubL variable in an Advanced Menu

SOLVE

you can use the vaiable {{ request.query_dict }} to pull the query from the url.

 

You would need to create your menu using static HTML and format the link with the variable. You can use the same HS menu markup http://designers.hubspot.com/docs/cos/hubspot-menu-markup

<a href="//www.example.com">{{ request.query.title }}</a>

View solution in original post

ndwilliams3
Solution
Key Advisor

Using a HubL variable in an Advanced Menu

SOLVE

for default text use.

 

<a href="//www.example.com">{{ request.query.title|default('Hello World'}}</a>

View solution in original post

2 Replies 2
ndwilliams3
Solution
Key Advisor

Using a HubL variable in an Advanced Menu

SOLVE

you can use the vaiable {{ request.query_dict }} to pull the query from the url.

 

You would need to create your menu using static HTML and format the link with the variable. You can use the same HS menu markup http://designers.hubspot.com/docs/cos/hubspot-menu-markup

<a href="//www.example.com">{{ request.query.title }}</a>
ndwilliams3
Solution
Key Advisor

Using a HubL variable in an Advanced Menu

SOLVE

for default text use.

 

<a href="//www.example.com">{{ request.query.title|default('Hello World'}}</a>