conditional display of confluence content?

Is there a way to display content in confluence 3.5 based on some condition? Eg the presence of a label is good enough.

The if-label user macro is almost perfect, but it doesn't work well for:

  • list item: starts a new list or, weirdly, subitem
  • table row: starts a new table

Thanks in advance for any answers! Bounty 20 points is on offer :-)

1 answer

How about using html macro and adding javascript in there:

<html>
<body>
<div id="container" style="float:left;">
my<br> dynamic<br> contents
</div>

<script type=text/javascript>
var container = document.getElementById('container');
var containerHeight = container.clientHeight;
 
if (containerHeight >= 100) {
    dispaly("big sideBanner");
} else if (containerHeight > 50 && containerHeight < 100) {
    display("middle sideBanner");
} else {
    display("small sideBanner");
}
</script>
</body>
</html>

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Nov 29, 2018 in New to Confluence

How to use Confluence Cloud for stakeholder management

Most of us don’t need much convincing that stakeholder management is important. It just makes sense that keeping everyone in-the-know on projects and assigning clearly defined roles is key to having ...

1,205 views 4 6
Read article

Atlassian User Groups

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!

Find my local user group

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

Groups near you