custom code only on 2 pages
Dear community,
Does anyone have an example of how we could use the page FreeMarker context object (http://community.lithium.com/t5/Developers-Knowledge-Base/page-FreeMarker-context-object/ta-p/9331) to specify a code to run only on two pages (based on URL).
Context: we have a remarketing code snippet that we want to fire when a user goes to two specific pages. Lithium said that we can only do this via the skin part, but that will enable this snippet on all pages. We only want it on the main page (e.g. /#) and a board (e.g./t5/community/b/AwesomeBoard)
Thus, was wondering if someone could assist in showing an example
e.g. (sorry for the terrible syntax) :
<#if page.isLink(url || url) >
<code snippet here>
</#if>
Thanks a lot,
Y
The page object doesn't support that. Instead, use the http.request context object which does have a url method. Using that along with the Freemarker contains built-in can do what you want. For example:
<#if http.request.url?contains("/t5/path/to/page1") || http.request.url?contains("/t5/path/to/page2")> <code for special pages here> </#if>