Forum Discussion

yurikleban's avatar
9 years ago

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-...
  • rwm's avatar
    9 years ago

    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>