Lindsey
6 years agoLeader
page.content.head.setTitle not working
For SEO purposes, we are trying to change the page title and description on the ForumTopicPage so the tags in the head tag will look similar to how they did in our old forums site.
I found this article about how to change the page title and description. In Common.init.ftl, I added this:
<#if page.name == "ForumTopicPage">
${page.content.head.setTitle(page.context.thread.topicMessage.subject + " - " + page.context.thread.topicMessage.board)}
${page.content.head.setDescription(page.context.thread.topicMessage.subject)}
</#if>
This did not work - the content in the title and description tag did not change. I also tried just adding this:
${page.content.head.setTitle("Test")}
${page.content.head.setDescription("Test")}
This did not work either - I expected every page to have their title and description meta tag to contain "Test", but they remained the same. How do I properly use setTitle and setDescription functions to change the title and meta description tags on the ForumTopicPage?