I'm trying to find out what the home page of a space is. I'm aware of '$content.getAncestors().get(0)', which can be used to get the full name (i.e., not the display title) of a page. However, when I try to use this in a user macro on the home page itself, it throws up an exception ("Error occurred rendering template content").
Is there another way to find out what it is?
Also, is there a way of getting the display name of the home page too?
I can't seem to find anything in the API documentation relating to '.getAncestors', and doing something trippy like $content.getAncestors().get(0).getDisplayTitle() doesn't work. Can someone point me in the right direction?
There's the $content.isHomePage() method. I'm not sure I get exactly what you're doing, but you might be able to iterate over all the pages until you find the home page. Something like this (not tested):
#if ($content.getAncestors()) #set($ancestors = $content.getAncestors()) ## iterate over the ancestors #foreach ($p in $ancestors) ## do your checking here by getting the content object and then calling isHomePage()... #end #end
Badges are a great way to show off community activity, whether you’re a newbie or a Champion.Learn more
I am the product of AIM. I can hear that door swinging open and closed in my mind with absolute fidelity. I’d recognize that ding anywhere. At 15, as I typed away into AOL IM, I never imagined that ...
Connect with like-minded Atlassian users at free events near you!Find a group
Connect with like-minded Atlassian users at free events near you!
Unfortunately there are no AUG chapters near you at the moment.Start an AUG
You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs