Lindsey
6 years agoLeader
page.content.head.setTitle not working for custom page
The freemarker function .setTitle() is not working for me for a custom page that I created. I created a custom search page titled "forums". I tried following the instructions from this post to set the title tag for this page.
In Common.init.ftl, I have this code:
<#if page.name == "forums">
<#assign labelListParam = webuisupport.path.rawParameters.name.get("forum","")>
<#assign selectedLabels = labelListParam?split(",")/>
<#assign labelsPageTitle = ""/>
<#assign titleIsEmpty = true/>
<#if selectedLabels?has_content>
<#list selectedLabels as selectedLabel>
<#if selectedLabel?contains("_")>
<#if !titleIsEmpty>
<#assign labelsPageTitle += ", "/>
</#if>
<#assign labelsPageTitle += selectedLabel?keep_after("_")/>
<#assign titleIsEmpty = false/>
<#else>
<#if !titleIsEmpty>
<#assign labelsPageTitle += ", "/>
</#if>
<#assign labelsPageTitle += selectedLabel/>
<#assign titleIsEmpty = false/>
</#if>
</#list>
${page.content.head.setTitle(labelsPageTitle)}
<#else>
${page.content.head.setTitle("Labels")}
</#if>
</#if>
The page title for this page is just showing up as "forums | (our community name)". Why is this not working for me even though it is for a custom page?