Forum Discussion
Hey Alan,
I believe everything after the period is ignored for the page name, so the page name will be "CategoryPage" here.
One good way to check what the name of a page is is as follows:
- Create a component that just outputs ${page.name}
- Put the component on the page that you want to see the name of
- Go to the page that you want to see the name of
Hope this helps,
Yuri
- iftomkins12 years agoMavenHi Yurik,
Yes, you're right, it only outputs CategoryPage for the page name (${page.name} is good to know).
This is a challenge for us because we have 2 pages which are both CategoryPage. How do we tell them apart with freemarker conditionals?
Can you do page.template-name? Because they use different templates.
Another thought is node.id, but I only saw an option for coreNode.id.
- Alan- AdamN12 years agoKhoros Oracle
If you need to know the name of a custom page that's being used for a particular node, you should be able to pull that information from the node settings. There are a series of settings in the "quilt" settings group that specify the name of the custom page being used. For a category page, the name of this setting is "quilt.categorypage". So then it's just a matter of retreiving the value via the REST API.
For example, let's say I have a category with id CategoryABC and for that category I've gone into the Category Admin and set Content > Custom Pages > Category Page to "CategoryPage.XYZ". If I make this REST API call:
/restapi/vc/categories/id/CategoryABC/settings/name/quilt.categorypage
Then I will get back a value of:
CategoryPage.XYZ
The process is similar for other page types (i.e. The Forum Page setting is "quilt.forumpage"). Just keep in mind that what you're essentially doing is retreiving the value that has been set for the node in the Community Admin.