CMS Development

DanielSanchez
キーアドバイザー | Platinum Partner
キーアドバイザー | Platinum Partner

HUBDB: customize dynamic page head?

解決
Hello Champions!
 
I need to insert a DataLayer script on my product pages. The problem is that each product should have a different script on the head, but I use a single template for all product pages as it is HubDB.
 
How could I customize the head scripts for each product page created dynamically in HubDB?
 
 
Thanks!
1件の承認済みベストアンサー
Anton
解決策
名誉エキスパート | Diamond Partner
名誉エキスパート | Diamond Partner

HUBDB: customize dynamic page head?

解決
Hi @DanielSanchez,

We're talking about js scripts, right?

There are two ways that come to my mind. (sorry @piersg for jumping in 😉)

1. Add a column into your HubDB where you place the URL to the script and call/load it in the template

2. If your scripts have the same nameimg-convention like my-script-1.js, my-script-2.js... you could add another column into the HubDB where you place only the last/changing bit in. On your template you could do something like
<script src="my-script-{{row.js_number}}.js"></script>

(Sorry for not using the code view - typing from my phone)


Hope this helps

Best, Anton
Anton Bujanowski Signature

元の投稿で解決策を見る

2件の返信
Anton
解決策
名誉エキスパート | Diamond Partner
名誉エキスパート | Diamond Partner

HUBDB: customize dynamic page head?

解決
Hi @DanielSanchez,

We're talking about js scripts, right?

There are two ways that come to my mind. (sorry @piersg for jumping in 😉)

1. Add a column into your HubDB where you place the URL to the script and call/load it in the template

2. If your scripts have the same nameimg-convention like my-script-1.js, my-script-2.js... you could add another column into the HubDB where you place only the last/changing bit in. On your template you could do something like
<script src="my-script-{{row.js_number}}.js"></script>

(Sorry for not using the code view - typing from my phone)


Hope this helps

Best, Anton
Anton Bujanowski Signature
dennisedson
HubSpot製品開発チーム
HubSpot製品開発チーム

HUBDB: customize dynamic page head?

解決

Heyo!

Wonder what @piersg , @Kevin-C  and @rikkilear think about this!