Documentation for Confluence 5.4.
Documentation for Confluence OnDemand and earlier versions of Confluence is available too.

Skip to end of metadata
Go to start of metadata

The Content by Label macro displays links to pages, blog posts and attachments that have been tagged with specific labels.

A working example

Below is a working example of the Content by Label macro, displaying content with the label 'LDAP'.

Showing first 5 of 863 results

Using the Content by Label Macro

To add the Content by Label macro to a page:

  1. In the Confluence editor, choose Insert > Other Macros.
  2. Find and select the required macro.

Speeding up macro entry with autocomplete: Type { and the beginning of the macro name, to see a list of suggested macros. Details are in Using Autocomplete.

To edit an existing macro: Click the macro placeholder and choose Edit. A macro dialog window will open, where you can edit the parameters of the macro.

Parameters

Parameters are options that you can set to control the content or format of the macro output. Where the parameter name used in Confluence storage format or wikimarkup is different to the label used in the macro browser, it will be listed below in brackets (example).

Parameter

Default

Description

Label(s)
(labels

None

Filter by label(s). The macro will display only the content tagged with the label(s) specified here. See also the Operator parameter below.

This parameter is required. Specify one or more labels, separated by a comma or a single space.

  • To exclude content which matches a given label, put a minus sign (-) immediately in front of that label value. For example: If you specify a label value of -badpage you will get only content which is not labelled with 'badpage'.
  • To indicate that the results must match a given label value, put a plus sign (+) immediately in front of that label value. For example: If you specify a label value of +superpage,+goodpage you will get only content which has at least two labels, being 'superpage' and 'goodpage'.

Author(s)
(author

None

Filter by author. The macro will display only the content created or updated by the author(s) specified here.

Specify one or more authors, separated by a comma.

For example: jsmith,jbrown

To include content from one user, but exclude from another user: jsmith,!jbrown

Include this Content Type Only
(type

all

Filter by content type. The macro will display only the content of the type specified here.

Specify one or more content types, separated by a comma or a space.

To exclude content of a given content type, put a minus sign (-) immediately in front of that content type. For example: If you specify a content type of -blogpost you will get pages and all other content except for blog posts.

Available values:

Show Labels for Each Page
(showLabels

true

Show or hide labels in the results.

Show Space Name for Each Page
(showSpace

true

Show or hide spaces in the results.

List Title
(title

None

Add a title or heading to the list.

Maximum Number of Pages
(max

15

Limit the maximum number of results to be displayed. Note that the results are sorted first, and then the maximum parameter is applied.

Display Excerpts
(excerpt

false

Include excerpts from each page listed. Note that you must have defined excerpts on each of those pages, by adding the excerpt macro to the page. Only the first few lines of the excerpt for each page are displayed.

Restrict to these Spaces
(spaces

@all

Filter by space. The macro will display only the content which belongs to the space(s) specified here.

Specify one or more space keys, separated by a comma or a space.

  • To exclude content in a specific space, put a minus sign (-) immediately in front of that space key. For example: If you specify a space key of -BADSPACE you will get only content which is not in the BADSPACE.
  • To indicate that the results must come from a specific space, put a plus sign (+) immediately in front of that space key. For example: If you specify a space key of +GOODSPACE you will get only content in GOODSPACE. (Note that this is not particularly useful, because each content item belongs to one space only. If you put a plus sign next to one space key and list other space keys too, the other space keys will be ignored.)

Special values:

  • @self — The current space.
  • @personal — All personal spaces.
  • @global — All site spaces.
  • @favorite — The spaces you have marked as favourite.
  • @favourite — The same as @favorite above.
  • @all — All spaces in your Confluence site.
  • * — The same as @all above.

When specifying a personal space, remember to use the tilde (~) sign in front of the username, such as ~jbloggs or ~jbloggs@example.com.

Operator
(operator

OR

The operator to apply when matching content against the labels specified in the Label(s) parameter:

  • OR – Display content with any of the non-prefixed labels.
  • AND  – Display content with all of the specified non-prefixed labels.

    (info) Note that this parameter only modifies the behaviour of the Label(s) parameter and only affects label values without a plus (+) or minus (-) sign prefix.

Sort By
(sort

modified

Specify how the results should be sorted.

Values:

  • title — Sort alphabetically by title.
  • creation — Sort by the date on which the content was added.
  • modified — Sort by the date on which the content was last updated.

Note: If this parameter is not specified, the sort order defaults to descending, based on the last modification date (latest first). To change the sort order from ascending to descending, use the Reverse Sort parameter.

Reverse Sort
(reverse

false

Select Reverse Sort to change the sort from descending to ascending. Use this parameter in conjunction with the Sort By parameter. Reverse Sort is ignored if Sort By is not specified.

Code examples

The following examples are provided for advanced users who want to inspect or edit the underlying markup for a Confluence page. 

 

Macro name: contentbylabel

Macro body: None.

Storage format example

Wikimarkup example

106 Comments

  1. Anonymous

    I would like the output to be just the page names as links, separated by spaces.  No icon, no "new line", no Space or Labels.  In this way I can, for example, create a table and fill a cell with links for a label-defined collection of pages.  A very dense way to build a reference page to items for sets of topics. Please!?

    Is this doable as a user macro?  Would the current source be a big help?

    Thanks! - Tom Evans 

    1. Anonymous

      Here is a great example of how this capability would be used:

        enterprisearchitecture.nih.gov
       

      The front page of this Enterprise Architecture site gives instant access to a large set of standards, organized by category.  A perfect use of  labels and content-by-label.  If these links were listed as one-per-line this Front Page would be three pages long, at least.

        • you could use the reporting plugin (if it's installed)
        • you could use this horrible user macro hack below. Uses metadata-report from the metadata plugin. By using metadata-report, you can use basic label logic, i.e. 'software+documentation' requires both labels. you could alter it to wrap the built in contentbylabel aswell.
        • the trimp and render velocity template definitions may not be needed if they are declared elsewhere
        ## Macro: contentbylabel2
        ## Macro does not have a body
        ## Macro returns HTML
        ##
        #macro(trimp $xhtml)
        ## remove leading <p> and trailing </p>
        #if($xhtml.startsWith("<p>",0) && $xhtml.endsWith("</p>"))
        #set($len=$xhtml.length()-$generalUtil.convertToInteger(4))
        #set($xhtml=$xhtml.substring(3,$len))
        #end
        $xhtml
        #end
        ##
        #macro(render $wiki)
        ## render $wiki in wiki renderer
        #set($globalHelper=$action.getGlobalHelper())
        #if($content) ## i. e. we render a normal page
          #set($renderer=$globalHelper.getWikiStyleRenderer())
          #set($context=$content.toPageContext())
          #set($xhtml=$renderer.convertWikiToXHtml($context, $wiki))
        #else ## we are e. g. in Global Template Preview
          #set($xhtml=$globalHelper.renderConfluenceMacro($wiki))
        #end
        #trimp($xhtml)
        #end
        ##
        ## Get parameters
        ##
        #set($key="")
        #if($paramkey)#set($key=$paramkey)#end
        #if($key.length()>0)#set($key="|key=$key")#end
        ##
        #set($sort="")
        #if($paramsort)#set($sort=$paramsort)#end
        #if($sort.length()>0)#set($sort="|sort=$sort")#end
        ##
        #set($delimiter=" ")
        #if($paramdelimiter)#set($delimiter=$paramdelimiter)#end
        ##
        #set($labels="")
        #if($param0)#set($labels=$param0)#end
        #if($paramlabels)#set($labels=$paramlabels)#end
        #if($labels.length()>0)#set($labels="|labels=$labels")#end
        ##
        ## retrieve pages with those labels (uses metadata-report for now)
        ##
        #set($wiki="{metadata-report:Title${labels}${key}${sort}}")
        #set($html="#render($wiki)")
        ##
        ## pull out just urls, skipping first array element
        ##
        #set($hrefs=$html.split('<a href='))
        #foreach($href in $hrefs)
        #if($velocityCount>1)
        #set($index=$href.indexOf("</a>")+$generalUtil.convertToInteger(4))
        #set($href="<a href=$href.substring(0,$index)")
        #if($velocityCount>2)
        $delimiter
        #end
        $href 
        #end
        #end
        
        1. Anonymous

          Wow. Thanks!

          This client site needs to get through an upgrade first (2.0.2 -> 2.7), so I won't be reporting success for (at least) a few weeks, but its great to see a solution, and community support in action.  - Tom

          1. Your problem has likely long been solved, but for folks looking for the source, it is available at:

            https://studio.plugins.atlassian.com/source/browse/ADVMACROS

  2. Is there anyway to do some kind of exclusion criterion? say

    Error rendering macro 'contentbylabel' : com.atlassian.confluence.macro.params.ParameterException: '!needs_review' is an invalid label.

    The practical application would be having a set of documents on varying yet very similar topics, wanting to display all except a particular subset that is flagged for review. Since I'd need to use more than one set of labels, I'm hard pressed to say ONLY dogs and reviewed, as I need cats as well, so setting the AND operator doesn't catch all the content, and OR sets the net too wide.

    1. You can do it with the Reporting Plugin. The 'labels' parameters on several macros there will let you specify "+" or "-" for "required" and "excluded", respectively. So, for example, you could do this:

      {report-list}
      {content-reporter:space=+@global, -EXCLUDED|labels=+dogs, +cats, -needs_review|type=page}
        {text-sort:content:title}
      {content-reporter}
      
      {report-body}{report-info:content:title|link=true}{report-body}
      
      {report-list}
      

      Which would basically give you all pages in all global (non-personal) spaces except the one called 'EXCLUDED' which have the 'dogs' and 'cats' label, but do not have 'needs_review'.

  3. Anonymous

    I see where the type "page" and blog-post" work, but I dont; see a full list fo other "types"

     in the search macro documentation I see a list of types- but they don't seem to be consistent -- I see "userinfo",  but I can't get any of these to work using this contentby label macro:

    userinfo, user-indo, user, users, profile, profiles, user-profile....

     in the search macro I see "blogpost" type but in this macro it is blog-post...  Is there some consistency that will be achieved here at some point? what types does this macro support right now? if not all- why?


    1. Hi,

      For Content by label macro, it's different with the space macro whereby it lists content with tagged labels. That means, it could be either page or blogs post. Having said that, labels work in pages and blogs post. In this macro, the "blogpost" type is used. For example:

      {contentbylabel:dogs|type=blogpost}
      

      Hope this helps. Thanks.

      Regards,
      MG

  4. In Conf 2.7.3, if no content in the space in which you were searching didn't have the label (e.g. labelx) you were looking for, the macro would return the text:

    No content found for label(s) labelx.

    In 2.10.1, the macro returns

    contentbylabel: 'labelx' is not an existing label

    This text is also highlighted in red and looks like a system error to the user.

    What can be done to fix this back to the way it used to be?

    Wiki markup:

    1. Bug reported to Atlassian: CSP-27601

      1. Hi Tomi,

        We are having similar problem with confluence 2.6 and confluence 2.10.3. Any update on this issues? I can not see the issue CSP-27601.

        Thx.

        1. Hi Vinay,

          We are having similar problem with confluence 2.6 and confluence 2.10.3. Any update on this issues?

          I have double check the issue CSP-27601. However, there is not much information in that issue. Also, I believe that the warning information is fix in plugin version 1.5.5. I have personally tried this, an it display same as in Confluence 2.6. Please give it a try.

          Hope that helps,
          Best rgds
          Zed

  5. I'd like to create a "Related Topics" section on a page that lists the pages that are related to the current page using the page labels as the associative element. If I'm reading the documentation correctly, the contentbylabel macro requires a label or labels as a parameter. It seems odd to have to provide labels as input to the macro, when I've already added labels to the page. Is there any way to have the contentbylabel macro use the current page's labels as the value of the label/labels parameter? I'm using Confluence 2.8.2, but plan on upgrading to the latest release soon.

    Thanks.

    1. Hi, David. If I am not wrong, you can use the {related-labels} macro to achieve this. Hope that helps!

      1. I believe the {related-labels} macro produces a formatted listing of labels related to the labels used on the current page. I'm looking for a formatted listing of pages like the one provided by the {contentbylabel} macro, and the listing should contain the pages related to the labels on the current page. If I were to use the {related-labels} macro, and somehow feed those results to the {contentbylabel} macro, I'd end up with a much larger listing of related pages, sort of an extended family of pages.

        1. David, I wanted the same thing and just recently created the following user macro: http://confluence.atlassian.com/display/CONFEXT/Related+Content+User+Macro that I believe suits your needs.

          1. Anonymous

            I was looking for the same thing and this user macro did the trick - Thanks.
            Maybe the staff can add this information on the bottom of the page (So it doesnt get lost in comments) (smile)

            1. Glad the user macro worked out for you. Let me know if there's an additional feature you'd like to see supported.

  6. I've added this macro to a number of pages, but I get "No content found for label(s)" all the time, evn though I know results exist for the search. I've tried rebuilding the index, but that doesn't help. Any suggestions?

    1. Hi Christian,

      If you are using 2.10, then by default the macro will return matches from the current space only. You can specify which spaces to include results from by using the 'space' parameter, or just add 'space=@all' to return results from the entire site.

      If that is not the problem, I would suggest raising a support request at https://support.atlassian.com/secure/Dashboard.jspa.

      Thanks,
      Mark

    2. Try:

      {contentbylabel:yourlabel|...everything else...}
      

      Did it work? (big grin)

      1. Anonymous

        Thanks for this advice :) I also had the "No content found for label(s) ." The problem was i used macro in this form contentbylabel:label=....  I have corrected to contentbylabel:mylabelname and i works!

  7. Anonymous

    i am trying to create a unique space, and have a content lst for the user that is logged-in.  Is this possible?

    I am running stand-alone evaluation, v. 2.10.

    thnx for your help!!!

    1. Hi there,

      I believe that Pagetree macro can help doing a content list in space. For further detail on how to use Pagetree macro please refer to this page:

      Cheers,
      Komathi

  8. Anonymous

    Hi,

    I'm using this macro as follows in Confluence Team Hosted 2.10.1:

    Content by label

    There is no content with the specified labels

    It seems to work fine in that it shows pages which do not have label done plus have MB and PCI labels, and policy, process or procedure labels.

    However it also lists pages that have a text value of policy, process or procedure but no labels of the same values (and which do not have label done plus have MB and PCI labels). So it seems to be searching the whole page, not just the labels.

    Am I doing something obviously wrong here?

    Thanks,

    Melissa

    1. Anonymous

      Macro code is

      {contentbylabel:label=-done,+MB,+PCI,policy,process,procedure|showSpace=false|showLabels=false|sort=title|space=@self|max=99}

      Melissa

    2. Hi Melissa,

      I noticed that you have already raised a support ticket in our support channel. We will proceed in keeping track of the progress of your issue through your support ticket.

      cheers,
      Henry CL Tiong

      1. Thanks Henry. I actually have a question about the documentation on this macro, which says:

        "To indicate that the results must match at least one of the specified label values, simply list the labels separated by commas. For example: If you specify a label value of -badpage,goodpage,superpage you will get content which has a label of either 'goodpage' or 'superpage' (or both) but does not have the label 'badpage'."

        I am possibly misunderstanding the meaning here, so need some clarification.

        If I have a content by label macro that specifies 'label=-ZZ,+AA,+BB,CC,DD'

        my list should show pages that don't have label ZZ, that have labels AA and BB, and also have label CC or DD (or both)?

        And further, if I have some pages with labels AA and BB, which do not have labels ZZ, CC or DD, should these show up in a content by label macro list that uses the above label specfications?

        Thanks

        1. Hello Melissa,

          I'm just confirming that your presumption is correct.

          Hence, if you had AA,+BB,+CC,DD,EE,-FF, then the parameter to which this applies:

          • must match BB AND CC
          • must match ONE OR MORE OF: AA, DD or EE
          • must NOT match FF

          Bear in mind that this principle applies to several of the parameters above: label, author, etc.

          Hope this clarifies the situation.

          Best regards,

          Giles Gaskell
          Technical Writer
          ggaskell@atlassian.com
          ATLASSIAN - http://www.atlassian.com

            1. Hello Melissa,

              While the information I wrote above is still true, I received some additional information about the operator parameter, which if used in conjunction with the label parameter, affects non-prefixed label values (i.e. labels without a '+' or '-' immediately preceding them). I don't know if this affects your situation, but it's worth mentioning because the behaviour is somewhat complex.

              Hence, if you had:

              labels=label1,label2,label3|operator=OR (this is the default behaviour of the operator parameter, which is the same as if it were not used in the macro at all)

              then your content must have one or more of the 'label1', 'label2' or 'label3' labels.

              If you had:

              labels=label1,label2,label3|operator=AND

              then your content must have all three 'label1', 'label2' and 'label3' labels.

              If you intend to use the label parameter with '+' or '-' signs prefixing any of its label values, then avoid using the operator parameter in the same macro to minimise confusion.

              The operator parameter is available to provide support for Confluence content which was written using older versions of the Content by Label macro, when at the time, the operator parameter was the only mechanism available to implement logical operations on a set of label values.

              The documentation above has been updated with this new information, so I hope this information helps.

              Kind regards,

              Giles Gaskell
              Technical Writer
              ggaskell@atlassian.com
              ATLASSIAN - http://www.atlassian.com

              1. Thanks Giles, that's good to know.

                Am a little confused though, as my support incident about this macro was closed recently, with the finding by Atlassian support being that the default OR operator functions to show '0 or more' labels, not '1 or more'. The documentation on this page was updated to reflect '0 or more', but I noticed it's now changed back to 1 or more. And in my Confluence Team Hosted instance it's definitely working as 0 or more (which I must say is not a particularly useful function to have - 1 or more makes much more sense!!).

                I've pretty much given up on this issue, but thought I'd mention it again as a) I'm sure you guys want the doco to be accurate, and b) '0 or more' functionality is basically useless, and might warrant further investigation...?

                Thanks

          1. It is not behaving that way for me.  When I have AA, BB, +CC it appears to be doing:

            • must match CC
            • can match AA, BB or neither
            1. Anonymous

              No response from Atlassian on this?

              1. Hi there,

                Please raise a support request or submit a question to Atlassian Answers. There, our support engineers will be better able to assist you.

                1. I asked the question on Atlassian Answers.  I am seeing the same results as Charles, where the non-required labels become optional once you specify a required label.  Hopefully someone can answer.

  9. Hi, is it possible to sort related contents by the number of tags related to the current content.

    Thanks.

    1. Hi agehl,

      I am afraid that this is not possible since the above {contentbylabel} macro and {related-labels} macro do not support any parameter to do this.
      If you are keen to have this feature in Confluence, feel free to raise an improvement request at http://jira.atlassian.com.

      I am not sure whether this will be helpful, however, there are some other macros such as popular-labels and Tagcloud Macro that you might want to try.

      Cheers,
      Komathi

  10. Anonymous

    I am hoping to ask the user a series of questions and, based on their response, vary the labels that a checklist is filtered by (i.e. pass a variable into the checklist function). Is this possible?

    Thanks

    Seb

    1. Hi,

      If you are referring to the checklist plugin. It seems that the parameter which determine the label used, does not support multiple labels. I would suggest you to direct your question to the author as I believe that they know more on the plugin than us.

  11. Anonymous

    Hi,

    is it possible to not show the message "No content found for label..." if nothing was found?

    Thanks

    BK

    1. Hi,

      You can try to edit i18n.properties for the following key macros.labelledcontent.no.content.found.for. As the file is inside confluence-advanced-macros-x.x.x.jar, you need to unjar and rejar it back again. You can refer to the following doc:

      Cheers,

    2. GuL

      We found a workaround solution for this, as we don't want to see the "no content found for label...", too.

      We have created a user macro, which simply get's this error message before rendering the html-code of the page and then replaces this error message string by a string defined inside the macro (possibly could be optimized by using a parameter for the new string).

      Using the macro you can output whatever you want, e.g. also an empty string.

      Here's our macro code, hope it helps.

      GuL

  12. Anonymous

    Hi,

    Can I fix some labels on a page in confluence such that only space admin or some restricted group can only delete it.

    I mean i want to fix just few labels for a page at the same time allowing user to play with other label i.e. they can add/remove more labels but can't change the fixed labels.

    thanx
    Manoj

    1. Hi,

      As far as I know, the feature requested is not available yet. However,I found a feature request which might be the closest to your requirement:

      If you are less happy about the feature request above, you might want to raise an improvement/feature request in JIRA:

      Please add your comments to the discussion, vote on it and add yourself as a watcher for future updates. Also, please bear in mind the following document on how we schedule features for inclusion in our products: Implementation of New Features and Improvements.

      Hope that helps.
      Best rgds,
      Zed

  13. Icon

    This post was also posted on the related content user macro page

    I have to categories of content in my space: topic and case. The pages are labeled "topic" and "case" respectively + labels describing the content, and are sorted in to separate page hierarchies. I want to list related topics in a page:

    The problem is that the above code renders a list with all pages having the "topic" label. The "topic" is not just a requirement, as I thought it was. Is it possible to render a list of pages within one page hierachy with related labels instead, and not just within the whole space?

    1. Hi Lars,

      I hope your question has been answered in the following pages:

      And yes you are right about the {related-content} macro that you can only restrict the macro to search a set of spaces or all spaces.

      Hope this will help others too.

      Cheers
      JSashi

  14. Anonymous

    Hi,

    I am looking at using this macro to return a list of pages with a particular label on them. However, I would like to display the page author, the creation date and the modification date along with the page title. Is this possible? I have tried using the reporter macros, but they run too slowly for us.

    Thanks.

    1. Hi,

      I am afraid that this is not currently possible. Feel free to raise an improvement request at http://jira.atlassian.com and describe in detail how you require this feature to work. Please add yourself as a watcher, vote for this improvement and add your own comments to this improvement request. For further details on how we include new features and improvements, you might want to read this page

      As far as I know, the reporting plugin should be able to do what you require. Perhaps, you can post the problem you are having in their issue tracker so that you can get a workaround or solution. You could also get more help in Atlassian Answers.

      Cheers
      JSashi

  15. Hi,

    I have created several "primary" pages and then a bunch of "secondary" pages.  I have taken the secondary pages and moved them to be children of the related primary pages.  I'm trying to use "space=@self" in the primary pages to display links to the children.

    This is what I'm using:

    'contentbylabel:label=pm-request|type=page|showLabels=false|showSpace=false|space=@self|sort=title'

    The problem is that for some reason that I don't understand, all of my secondary pages show up as links instead of the one single document that I've moved to be a child of the primary page.  I've turned the showspace to true and there isn't a space name... odd. 

    Can anyone please help me?

    Update: okay, I think I've figured out that all of the pages have the same "space" and that's why they're doing this... that doesn't help me solve the problem yet though.

  16. I'm trying to use this macro to return page with a combination of labels.   We have been labelling our pages with a "type" (standard, procedure, etc) and a domain (network, server, database)  - I can't seem to get the macro to return all pages for example that have both a "network" and "standard" label.   I want the results to be similar to the results I see when I click on the network label and then click on the "standard" related label and the list shows all pages with both labels applied.

    I hope I made it clear.  What I get right now  from this:

    Is a listing of all pages with either "network" OR "standards" label.

    Thanks,

    Dave

    1. Hi Dave,

      Use the 'operator' parameter and set it to 'AND'.

      i.e.

      {contentbylabel:labels=network,standards|title=Network Standards|max=5|excerpt=true|sort=modified|operator=AND}
      

      Cheers,
      Mark

      1. GuL

        Another option is to add a '+' before each must-have-label.

        e.g.

        hth
        GuL

        1. Thanks guys - both of those worked!

          Dave

  17. Anonymous

    I would like to categorize Wiki content based on labels that follow a certain pattern, such as "foo.bar.1", "foo.bar.2", "bar.baz.1", etc.) and then create reports listing subsets of pages that match similar patters, such as "foo.*", or "*.bar.*" etc. There could be a fairly large number of such labels (dozens).

    I don't suppose it's possible to use some sort of a globbing pattern or regular expression as the name of the label in {contentbylabel:label=RE}, is there? If not, is there already a feature request for this ability or should I create one?

    1. Hi,

      I am afraid that this is not currently possible. Feel free to raise an improvement request at http://jira.atlassian.com. and describe in detail how you require this feature to work. Please add yourself as a watcher, vote for this feature and add your own comments to this request. For further details on how we include new features and improvements, you might want to read this page

      Cheers
      JSashi

  18. Anonymous

    Is there a way to get the macro to produce a number representing the number of records matching the query instead of the list of results? I'd like to be able to use the results in tables and charts. Like so:

    and have it rendered like so:

    Number of Pages To Fix

    Number of Pages Fixed

    123

    456

    1. Hi,
      Unfortunately, the feature that you are after is not available. Please feel free to make a feature request under Confluence project at http://jira.atlassian.com. jira.atlassian.com is where our programmers keep track of the bugs, task, feature & improvement request, etc. Please share your comment by creating a new issue, vote on it, and add yourself as a watcher for future update.

      As a workaround, I'd suggest to query the content label from database via Confluence SQL Plugin. The tables you need to look into are label and content_label. We can link these tables via labelid and group by labelid to count the usage of each label, for example:

      SELECT l.name as Label_Name, count(1) as Label_Usage
      FROM confluence.label l, confluence.content_label c
      where l.labelid = c.labelid
      group by c.labelid;
      

      Simply call the query above with Confluence SQL plugin, and it will give you a nice chart on the Label count. If you face any difficulties in using the SQL plugin, please feel free to create a support ticket at https://support.atlassian.com/.

      Hope it helps. Please feel free to ask if you need further assistant.

      Thanks & regards,
      Jack

  19. it looks like your space or spaces parameter is set to "key", while it should be set to and existing space key, several keys, or a special operator (e.g. @all or @self)

  20. Is there any way to retrieve which users have used a personal label? Preferably from the PROFILE page but Personal Space is OK too. 

    {contentbylabel:labels=my:project|spaces=@personal} does not seem to do the trick. 

  21. I would like to use Content by Label to populate table of contents sections dynamically, but I need the links to appear as bullets, as in a table of contents.

    Can someone suggest a snippet to help me display the results of content by label in a different way?

    1. Hi Matt,

      Not sure if this is what you wanted, but you can tweak the stylesheet to suit your needs. In order to do this, go to Dashboard > Administration > Look and Feel > Global Stylesheet and enter the following:

      Feel free to change the code. Hope this helps.

      Cheers
      JSashi

      1. JSashi

        Thanks for your reply.

        OK - I tried it out - and it does change the way the items are displayed, so that's good. But I cannot remove the tiny underlining, and the bullets are out of synch with the text because of the underlining. I want to display the results of contentbylabel as TOC entries with links, NOT as attachments.

        Is this snippet only going to change the way contentbylabel results are displayed? I don't want to break anything else.

        thanks

        -mbb

        1. Hi Matt,

          I am not able to understand the problem right now. Perhaps the Confluence version you are using might be displaying it differently. Could you tell me the version of Confluence you are using and also the exact code for the {contentbylabel} that you are using. You can also ask a question on Atlassian Answers and attach some screenshots of the problem/requirement that you have. Once you have done that, please comment back here with the forum link.

          Cheers
          JSashi

  22. Hi there were using Confluence 3.1 and would like to be able to display labels on a page which then link through to a list of pages which have all used the label.

    Is this possible?

    I've tried using the Contentbylabel macro but this displays content rather then the labels themselves.

    1. Hi James,

      I think the Labels List Macro does what you want.

      If not, there are other options listed at Using Label Macros to Categorise Wiki Content.

      Cheers,
      Mark

  23. Anonymous

    This macro is almost perfect for my needs except that I want to "sort by natural page order". I either get alphabetical, create or modified date.My goal is to show subsets of children pages by use the inherent page order ability of confluence.

    Any suggestions?

    Doyle

    1. Anonymous

      I was wondering if you found a solution to this ? I have the same issue. I really want to report on the order of the pages within the parent page..

      Chris

  24. Anonymous

    Is there a way to use wildcards with contentbylabel?  I'd like to list all pages with labels that start with a certain string.

    1. I'm afraid that's not possible. You may get this sort of error:

      Error rendering macro 'contentbylabel' : com.atlassian.confluence.macro.params.ParameterException: 'la*' is an invalid label.
      1. Anonymous

        are you planning on implementing this feature?

  25. This is a great macro, but if I only show 15 of 19 results, how do I let my users see the rest? 

    Seems like we need "More..." like the {recently-updated} macro uses.


    1. I strongly agree... This macro is powerful, but I have no way of knowing ahead of time how many pages would be returned by the search.  A "more" button would be a big help!

      1. Anonymous

        I agree too!

    2. Anonymous

      100% agree - this is a pretty severe failing in this macro.

  26. Anonymous

    I would like to a see a parameter to add the ''last editted'' date to every page in the list of pages...is this possible?

  27. Anonymous

    Can we please get NOT or ! supported as a Operator?  That would add huge value to this macro.

  28. Anonymous

    Opened a ticket for the NOT operator, please vote for it if you need it.

     

    https://jira.atlassian.com/browse/CONF-24247

  29. Anonymous

    Was wondering if there was any way of breaking a long list of labels into two columns using the same label so that it's easier to read the list, haven't been able to find anything but hopefully somebody might know something I don't know.

  30. Anonymous

    Sort by label would be fantastic!

  31. Is there anyway to use another macro within contentbylabel?

    What I want to do is a dynamic view, i.e.:

    contentbylabel:labels={report-info:title}|macros=true|showLabels=false|showSpace=false|maxResults=99|space=@self

    So this would render a contentbylabel always based upon the labels = title of the page.
    Any ide on how to solve this?

    BR
    Tilly

    1. Hi Mr Tilly.

      I think this is the solution you looking for:

      {replace-and-render}{replace-body}{contentbylabel:%title%|showLabels=false|title=whatever:}{replace-body}{replace-item:%title%}{builder-pagetitle}{replace-item}{replace-and-render}

      I hope its useful.

      //Johan Hellstrom

      1. Works like a charm!

        Thanks.

         

        /Tilly

  32. Anyone have some guidelines as to what style properties I can use to change the appearance of the label list? For example, I'd like the Labels to show up under the related page, but in a light gray rather than the standard link color.

  33. Is the source code for this macro available somewhere? I searched a few spots and could not find it. THanks!

    matt

  34. Anonymous

    It looks like there is a bug with the Display Excerpts option when used within the Column macro. I haven't solidified the cause completely it seems to happen only when the excerpt is large or has some special characters. Whatever the case is I find the content derived from the Content by Label macro can return data that will spill out of the column bounds. In this example I have two columns. The first is set to 75% and the second to 25%. We can see tables show up inside the excerpts and the column widths are ignored. Sorry the comment is so large, it was hard to find confluence content that would demonstrate this problem.  Any ideas on a workaround?

     

  35. After adding the 'Content by Label' If you receive an error saying no content available, go to Confluence Admin -> Content Indexing and rebuild the search index.

  36. Anonymous

    This option as well as the navigation map should be available for spaces not only for pages!

  37.  

    Is there a way to do the following in teh content by label macro:

    Show pages which have (NOT AA) AND (NOT BB OR NOT CC OR NOT DD).  I am trying to do a control list to check all pages within a space have one of BB CC or DD labels, ignoring those which are in category AA.

    Thanks

    Bruce

     

  38.  

    Also:

    ((AA AND NOT BB) OR CC) AND DD

    ?

  39.  

    Is there a way to format the listed content so that it doesn't show the icons? 

  40. Three way to do that :

    • Use JS to hide icon
    • Modify the macro in source code
    • Create a new user macro
  41. Recently i created a bug report where you sometimes get a error: "Error rendering macro 'contentbylabel' : null"

    CONF-30009 - ContentByLabel macro sometimes give: "Error rendering macro 'contentbylabel' : null" Resolved

  42. Anonymous

    Is it possible to use a variable for "SpaceKey" in the field for Label(s)?  I would like to create a Content by Label macro that will pull any content labeled with the SpaceKey for the Space that the macro resides in.  Is that possible?

    1. You can use "@self" at SpaceKey, Think that is what you want (wink)

      1. Peter, thank you so much for the quick response.  But unfortunately, that does not seem to work.  I get the following error message when trying to view the macro.  

        Error rendering macro 'contentbylabel' : com.atlassian.confluence.macro.params.ParameterException: '@self' is an invalid label.

         

        Any other ideas?  Am I doing something incorrect?  Thanks again for the response.

        1. Seems like you try to fill in "@self" at labels, but this should be at "Restrict to these Spaces".

          1. Peter,

            Sorry for being unclear.  The content I want to view is actually in another Space, but the specific Page we want to include in the Content Macro is labeled with the Space Key.

            For example, there is a Page with the label "ACME" in the "Open Projects" Space.  I want to be able to use a Content Macro to view any Pages with the label "ACME" in the "ACME Company" Space with Space Key "ACME".

            Does that make any sense?

            1. In that case just use the label "acme" (labels should always be lower case) and just "ACME" at Restrict to these Spaces

  43. Anonymous

    The formatting of the result list is realized in the moment with divs containing the pagelink and a span-element containing the excerpt-entries. On the one hand it's a little scary to see a excerpt list with pagelinks of different length since the excerpts don't start ordered as I would expect in tables or divs with right margin. On the second hand the excerpt wraps under the pagelink when some more complex content is embedded like a simple paragraph.

    I would suggest to improve the display using div's only - either with float/margin or with display:table-cell as you announced in the 5.2 release for the general table design.

  44. Anonymous

    Is it possible to have the macro display the number of items that are returned?

    If I set a limit on the number of results, the macro will display "Showing xx of xx results" when it hits the limit - but it doesn't offer me any way to expand the list to view the rest of the items. 

    So, I would like to be able have the "Showing xx of xx results" viewable even when the limit of items has not been reached.

    My end goal is to have a dynamic counter of results returned for a table. 

  45. Anonymous

    I must be doing something wrong with this macro because no matter what I set the "Maximum Number of Pages" to, it still only shows me at most 6 of my 7.  Ideally this macro would list all of the pages with the matching label.

     

    I added and labeled the seventh page after the macro had already been placed on its home page.  Is there something I need to refresh to get it to work properly?

  46. Following on this comment above, is it possible with AOD Confluence to have the Related Content by Label set so that it searches for the labels already attached to @self? I tried using @self in the Label(s) field for this macro and the Content Report Table, but neither accept it. Other workarounds?

  47. I tried using this on Confluence 5.4, in a page with label "vpn", and the macro specifying the label "vpn". The list of Related Articles contains the page itself... which seems undesirable in basically all cases. Is this expected behaviour? I would have thought the list should always exclude the page in which the macro is executing.