Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Next challenges

Recent achievements

  • Global
  • Personal


  • Give kudos
  • Received
  • Given


  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

How do exclude the current page from the display when using the Content by Label macro?

I use the Content by Label macro in many situations, but would like the page being viewed to not appear in the list generated. For example, I have 5 pages all related to Resource Management (my label). I want each of the 5 to display a link to the other 4 but not itself. How can I do that?

4 answers

3 votes
Deleted user Mar 07, 2017

We have the Cloud version of Confluence, so Stephen's solution won't work for us.

If your version of Confluence has CQL filters ("Add a filter" option), you can add a filter for the "With Title" field.

Enter the title of the page with a minus in front of it (e.g., "-My Page").  That's the only way I could figure out how to do it, except that it's a pain to have to explicitly enter the page name.  It would be nice if the macro could take an @self variable or something like it.  (Maybe it can, but I haven't found anything on it.)

I don't think it supports a reference to itself, but one option would be to use the CQL Search macro and simply use a CQL query like 

type=page AND space=spaceKey() AND id!=pageId() AND label=mylabel

and it would automatically generate a list of pages in the current space with that label excluding the current page.

Deleted user Mar 08, 2017


I'll have to get approval to download and install the plugin, but this looks like the perfect solution for us.


Deleted user Jul 24, 2017

We can't install Stephen's plugin, but the CQL query macro will take his filter.  Unfortunately, the CQL query macro (in Cloud version anyway) has a fixed report-style output format, with lines, a constant background color, etc., so it can't be used the way Content by Label is. It's not flexible enough. Why doesn't Atlassian listen to users, instead of always coming up with close, but not quite usable solutions.

Hi Gabrielle,

I did write the CQL query macro for Cloud, so I don't see why I couldn't implement a different display style as a new feature. Stay tuned!

(At least I'm assuming you're talking about the CQL Search add-on; it's not very clear from your comment as there is no built in CQL Search macro that I am aware of that allows you to reference the current page/space)

Deleted user Jul 25, 2017

No, I'm talking about a macro called CQL Query. We also have a Search Results macro that uses slightly different syntax:

ConfluenceMacros.pngNeither of these macros allows any user control of output. It's very frustrating.  It would be nice if the Content by Label macro, which does have output control, let us use a CQL query to refine the filter, instead of forcing us to use the crippled "user-friendly" interface.  There's nothing friendly about being stopped from doing very simple things. I found out the "With Title" filter allows only the CONTAINS operator. In other words, there isn't any way to exclude the current page, even by entering each title, because the filter won't accept any form of NOT. You can just filter labels that way.

I'm late to this, and it's not a perfect answer, but i can confirm that @[deleted]'s hack of adding -The+Name+Of+The+Page to the Title field works. Obviously not a great solution for large Spaces.

The problem I've found with the With Title -{my page title} filter is that there doesn't seem to be any way to tell it to exclude only pages with that exact title.

The page I'm trying to add the filter to is called Reports.  However, there is another page which includes the word "Reports" in the title.  If I add a With Title filter of -Reports that will exclude both pages.  I've also tried -"Reports" (surrounding the page title in double quotes) and -'Reports' (surrounding the page title in single quotes), with no success.

There's currently an open feature request for this feature:

But I did make a workaround until it can be implemented. I included a workaround in the ticket which I will duplicate here. If you include this in your Custom HTML (make sure you copy everything):

<script> $(function() { $('.content-by-label > li > div > a').filter(function() { return $(this).attr('href') === contextPath + '/pages/viewpage.action?pageId=' + AJS.params.pageId || $(this).attr('href') === contextPath + '/display/' + AJS.params.spaceKey + '/' + AJS.params.pageTitle.split(' ').join('+') }).parent().parent().hide().parent().next().filter('div').hide(); }); </script>

Then it will hide the current page from the results of the Content by Label macro. It's not perfect, but it should help.


Thanks for the quick response. I have a couple of questions:

  1. being still relatively new to Confluence, how do I implement your script?
  2. in reading the related responses, it sounds like it doesn't work with the Documentation theme (which I'm using with version 5.8.13). Is that true?
  3. Finally, I went to the link you provided for the open link which looks like it was open in 2006, can this really be left open for 10 years? Also, it listed duplicate requests which were marked a completed which seems confusing.

Thanks again 

Hi Sandy,

You can filter Content by Label macro table with Table Filter macro to hide the page.

This works for the server version:

If you have Source Editor then you can add “label=yourLabel and content != currentContent()”

 Another solution is to highlight the title of the current page in bold using space style sheets similar to the Page tree macro.

Not a solution for Cloud.

But works great on Server version. Thanks, @Dmitry Ree

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Confluence

Announcing Team Calendars in Confluence Data Center

Hi Community! We're thrilled to share that Team Calendars for Confluence is now a built-in feature for Confluence Data Center releases 7.11 and beyond.  A long time favorite,  Team Cale...

101 views 0 3
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you