• We collect Confluence feedback from various sources, and we evaluate what we've collected when planning our product roadmap. To understand how this piece of feedback will be reviewed, see our Implementation of New Features Policy.

      NOTE: This suggestion is for Confluence Server. Using Confluence Cloud? See the corresponding suggestion.

      I see from the related issue that you did add CQL, but I was talking about using it Inside of a Macro to return CONTENT, not a just a list of pages from the search bar. I want to return content from pages by using CQL parameters. This would be useful.

      You could match on labels, creation time, space, attachments, whether it has children, etc.

      You could match on some of the attributes here:
      https://developer.atlassian.com/static/javadoc/confluence/latest/reference/com/atlassian/confluence/pages/Page.html

      I ran into the need when I wanted to include all of the pages of the children of a parent essentially the cross between the page include and the children include macros. However there were so many pages it would be very tedious to do so with page includes.

      I started writing a macro for it, but I don't think we should need to make our own macros to do something so simple. The Macro I was writing nearly works, but it doesn't include the macros that are on the pages of the children, so all panels and other stuff are lost essentially.

      Even that however, was a workaround for what I really needed.

      What I really needed was to include the content of all children of a certain parents who matched a certain creation date. So I could have 1 dynamic page, whose content changed day to day based on which pages matched the creation date parameters. A shift log that would always have content from a time-span of 24-0 hours ago.

      Now if CQL worked with the page include macro, then that would solve my issue.

        1. ss1.JPG
          ss1.JPG
          55 kB
        2. ss2.JPG
          ss2.JPG
          67 kB
        3. ss3.JPG
          ss3.JPG
          72 kB
        4. ss4.JPG
          ss4.JPG
          58 kB

          Form Name

            [CONFSERVER-36546] CQL to return content WITHIN a Macro

            Thank you for raising this suggestion.
            We regret to inform you that due to limited demand, we have no plans to implement it in the foreseeable future. In order to set expectations, we're closing this request now. Sometimes potentially valuable tickets do get closed where the Summary or Description has not caught the attention of the community. If you feel that this suggestion is valuable, consider describing in more detail or outlining how this request will help you achieve your goals. We may then be able to provide better guidance.
            For more context, check out our Community blog on our updated workflow for Suggestions
            Cheers,

            Confluence Product Management

            Adam Barnes (Inactive) added a comment - Thank you for raising this suggestion. We regret to inform you that due to limited demand, we have no plans to implement it in the foreseeable future. In order to set expectations, we're closing this request now. Sometimes potentially valuable tickets do get closed where the Summary or Description has not caught the attention of the community. If you feel that this suggestion is valuable, consider describing in more detail or outlining how this request will help you achieve your goals. We may then be able to provide better guidance. For more context, check out our Community blog on our updated workflow for Suggestions Cheers, Confluence Product Management

            Alexander Baggett added a comment - - edited

            As for CQL, if I could use it in a macro without code, that would be cool. But for now just help me include all the children.

            This is what I have so far, its very close, but doesn't quite work.

            StringBuilder sb = new StringBuilder();
            ContentEntityObject ceo = context.getPageContext().getEntity();
            Page parent =(Page) ceo ;
            List<Page> children = parent.getChildren();
            for(Page child:children)

            { sb.append(child.getBodyAsString()); }

            return sb.toString();

            This is the basic idea, but it doesn't get any of the macros or non-text content.
            I need it to be able to do that.

            Alexander Baggett added a comment - - edited As for CQL, if I could use it in a macro without code, that would be cool. But for now just help me include all the children. This is what I have so far, its very close, but doesn't quite work. StringBuilder sb = new StringBuilder(); ContentEntityObject ceo = context.getPageContext().getEntity(); Page parent =(Page) ceo ; List<Page> children = parent.getChildren(); for(Page child:children) { sb.append(child.getBodyAsString()); } return sb.toString(); This is the basic idea, but it doesn't get any of the macros or non-text content. I need it to be able to do that.

            Apologies alexander.baggett you are observing expected behaviour there with the excerpt macro. Have you tried the approach of using CQL within your own macro?

            mackie (Inactive) added a comment - Apologies alexander.baggett you are observing expected behaviour there with the excerpt macro. Have you tried the approach of using CQL within your own macro?

            These are the 4 screen shots I mentioned in my post.

            Alexander Baggett added a comment - These are the 4 screen shots I mentioned in my post.

            I am sorry but what you are describing for the children display macro is not the case. The include excerpt parameter does not give you any control over what is included from the children.

            I have a parent page with children and a children display in the parent page and excerpts in the child pages, and only 2 words from the child pages show up in the parent page. It does not work the way to describe.

            Essentially the whole child page is wrapped in an excerpt and all the parent pulls is 2 words.

            I will attach 4 screen shots that when put together prove what I am talking about.

            Alexander Baggett added a comment - I am sorry but what you are describing for the children display macro is not the case. The include excerpt parameter does not give you any control over what is included from the children. I have a parent page with children and a children display in the parent page and excerpts in the child pages, and only 2 words from the child pages show up in the parent page. It does not work the way to describe. Essentially the whole child page is wrapped in an excerpt and all the parent pulls is 2 words. I will attach 4 screen shots that when put together prove what I am talking about.

            Hi alexander.baggett,

            The children display macro does support rendering excerpts and you do have control over each child page as to what that excerpt is. Have you tried playing around with this macro rendering excerpts, sorting by created date and applying a limit to meet your requirements?

            The combination of rendering and filtering options you described is not currently on our roadmap and so a custom macro using CQL would be needed if you needed a solution for this soon and the first suggestion doesn't work. CQL can be called from a P2 plugin with the request to expand content and this should work for both filtering (it supports ancestor = <pageid>) and rendering (via an expansion request). Example code:

            for (Content content : service.searchContent("ancestor = 1234 and created > now('-1d')", ExpansionsParser.parse("body.view")))
            content.getBody().get(ContentRepresentation.VIEW); // do something with content

            I hope one of these options works for you.

            mackie (Inactive) added a comment - Hi alexander.baggett , The children display macro does support rendering excerpts and you do have control over each child page as to what that excerpt is. Have you tried playing around with this macro rendering excerpts, sorting by created date and applying a limit to meet your requirements? The combination of rendering and filtering options you described is not currently on our roadmap and so a custom macro using CQL would be needed if you needed a solution for this soon and the first suggestion doesn't work. CQL can be called from a P2 plugin with the request to expand content and this should work for both filtering (it supports ancestor = <pageid>) and rendering (via an expansion request). Example code: for (Content content : service.searchContent("ancestor = 1234 and created > now('-1d')", ExpansionsParser.parse("body.view"))) content.getBody().get(ContentRepresentation.VIEW); // do something with content I hope one of these options works for you.

            Please read all of my post to understand what I am asking for.

            Alexander Baggett added a comment - Please read all of my post to understand what I am asking for.

              Unassigned Unassigned
              029477f0f6b8 Alexander Baggett
              Votes:
              3 Vote for this issue
              Watchers:
              7 Start watching this issue

                Created:
                Updated:
                Resolved: