Forum Discussion
You custom page title key will be something like this:
page.custom_page_name.title = Page Title
So your value should be similar to
page.custom_page_name.title = {0} Labels
and your dynamic value will be passed using:
page.custom_page_name.title = {0} Labels
<#assign Pagetitle = text.format("page.custom_page_name.title",value1) />
- Lindsey6 years agoLeader
This did not work. Now the browser tab just appears as {0} labels. I do have the logic for which labels are selected in an endpoint though, so maybe that is why it is not working
- Lindsey6 years agoLeader
Parshant I tried putting this logic into the component that exists on the page and just added "test" as the parameter, and this still didn't work. How would the page be able to know to take from the variable "Pagetitle" and put it in the title tag of the head tag?
- Parshant6 years agoBoss
Yes you are correct we cannot change Custom Page titles Dynamically with freemarker and text-keys.
But if its just for display purposes you can use javascript code in custom component and include to the custom page to change with Dynamic values.
<#assign Pagetitle = coreNode.title /> <script> document.title = "${Pagetitle}"; </script>
I know this method is not good but, its the only solution I have.
- Lindsey6 years agoLeader
Parshant that could work. So I am trying to put a hidden div that has the items I want to go into the head title, then in the liaAddScript I am doing document.getElementById to get that hidden div content. Then I do document.title = the freemarker text variable. It looks like this:
const headTitle = document.getElementById("headTitle"); document.title = "${text.format("page.GlobalLabels.title", )}";
Do you know how I can get that headTitle javascript variable into the freemarker variable? Is that possible?