I use the contentbylabel macro in a template to pull in lists of related pages based on labels. However, sometimes there are no related pages and I would like to know if there's some Velocity code I could use where if results = 0 I can put "N/A" or just not make it show at all.
The default Confluence behaviour of printing out "No content found for label(s) YOURLABELSHERE." is unattractive.
Thank you.
One possiblity is to hide the text using CSS.
Something like:
#main-content .tableview { visibility:hidden; }
However, this might have unintended consequences if you have any other content which matches that class.
Cheers,
Mark
Thanks for the suggestion but the tableview class is present regardless of whether there is content found or not. It really needs to be something I can get Confluence to run on when a condition is true or false.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
That does seem to be the case, sorry about that.
I found another couple of suggestions which might work for you:
Hope that helps more than my first suggestion :)
Mark
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Great!
There is also an open request to improve the experience in the macro itself, which you can vote on.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks, Mark. The JS solution works. Would have preferred something in VTL but this is fine.
Cheers!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.