Display the list of children for a page with customised details displayed.
Description
The standard {children} macro is very useful, but only provides one real option for display details about a page - the page excerpt. Sometimes other details can be useful to display also, and this recipe gives an example of displaying the page's most recent modifier and the date the modification too place on.
Since this is a replacement for {children}, we'll use the list report format. This also lets us specify that we want the report to drill down through the page's descendents using the 'depth' parameter:
{report-list:depth=all}
Now, we need to set up the reporter we'll be using to retrieve the relevant information.
In this case, we specify that we'll be using the local reporter to find the children. This is because we want the top-level of the list to just be the immediate children. The reporter will look after displaying the descendents of said children itself:
{local-reporter:content:children|type=page}
Since the extra information being displayed is related to when it was last edited, let's sort by the modification date. Also, we're probably more interested in the most recently edited content, so we'll display it in descending order:
We now need to close the content reporter macro so it will contain the sort details:
{local-reporter}
Now, we need to tell it what we want to display for each item.
Firstly, we open the report-body macro. It will need to be closed again at the end:
{report-body}
Next, we'll display the title of the page using the report-info macro, and have it linked to that page's URL by specifying the 'link' parameter. In this case, it is the Content Supplier providing the information:
{report-info:content:title|link=true}
Next, we'll output the modification date and the user who did the modification. Again, we'll create a link to the modifier's homepage using the 'link' parameter:
({report-info:content:modification date|format=dd MMM, yyyy} by {report-info:content:modifier|link=true})
If you want to sort by a custom order, try mixing in the Scaffolding Plugin (you will need at least 2.2-DR3 for this to work). On each page, use the {set-data} macro (or any of the other data macros) to store a custom sort field:
{set-data:Order|type=number}5{set-data}
You could also use text or dates if so desired.
Once you've done that, just specify that the {content-reporter} should sort by the new data field (namely 'data:Order'):
You can filter by other values, such as labels. The example below filters so that only pages which do contain 'foo' and don't contain 'bar' are included.
Alternately, you can filter by any custom value. Say you have a {date-data} macro on your pages called 'Date of Birth'. You can filter out all dates before January 1, 2000 like this:
Hi I am using following macro to display all child pages.
=========================
{report-list:depth=0\|style=none}
{content-reporter:scope=parent page> children\|type=page}
{text-filter:content:body\|html escape}
{report-info:content:summary}
{date-sort:content:creation date\|order=descending}
{content-reporter}
{report-body}
{report-image:content:icon} * {report-info:content:title\|link=true} - ({report-info:content:modification date\|format=dd MMM,yyyy} by {report-info:content:modifier\|link=true\|} \-\\- viewed {tracking-info:value=view count} zero {tracking-info} times.)
{report-body}
==========================================
Which gives me following results
The title of the page
(08 Oct, 2007 by userA ? viewed 5 times.)
h2 {color:#333333}{*}Description{*}{color} Some text goes here...... h2 {color:#333333}{*}Script Version{*}{color} 1.0 ....
How do I escape the wiki mark up ( h2. {color} etc) and show just TEXT . I don't want to use wiki markup either
{report-info:content:body > first 100 \|render=wiki } because I am just trying to show a TEXT summary or snippet of each child page.
I'm not quite sure what you're asking - the example you posted seems somewhat garbled...
You can use the {report-info:content:summary} to display a short summary. I'm not quite sure what you mean about displaying text vs wiki markup. By default, {report-info} will escape any markup. It will only render it if you specify 'render=wiki'.
Thanks for the reply.
Hi David Thanks for the reply. gives me text but the text contains the the formatting anchors or tags for e.g h2 and color Is it possible to get just text wihout any formatting tags? Thanks  gives me text but the text contains the the formatting anchors or tags for e.g h2 and color
Is it possible to get just text wihout any formatting tags?
Ah - you want to strip out any wiki markup. There is nothing currently which would do that. I'm not certain how that would be achieved anyway. The only way I could think of is to render the text, then get only the 'text' portions of the resulting HTML. However, given that the HTML which is generated by Confluence and other macros is somewhat unreliable, it would have to be cleaned up first.
Whatever the case, it probably won't be an effecient process, even if it's implemented. But if you'd like to see it sometime, raise a feature request. No promises on when/if it will be implemented though.
Hi I am using following macro to display all child pages.
=========================
{report-list:depth=0\|style=none} {content-reporter:scope=parent page> children\|type=page} {text-filter:content:body\|html escape} {report-info:content:summary} {date-sort:content:creation date\|order=descending} {content-reporter} {report-body} {report-image:content:icon} * {report-info:content:title\|link=true} - ({report-info:content:modification date\|format=dd MMM,yyyy} by {report-info:content:modifier\|link=true\|} \-\\- viewed {tracking-info:value=view count} zero {tracking-info} times.) {report-body} ========================================== Which gives me following results The title of the page (08 Oct, 2007 by userA ? viewed 5 times.) h2 {color:#333333}{*}Description{*}{color} Some text goes here...... h2 {color:#333333}{*}Script Version{*}{color} 1.0 .... How do I escape the wiki mark up ( h2. {color} etc) and show just TEXT . I don't want to use wiki markup either {report-info:content:body > first 100 \|render=wiki } because I am just trying to show a TEXT summary or snippet of each child page.Thanks
I'm not quite sure what you're asking - the example you posted seems somewhat garbled...
You can use the {report-info:content:summary} to display a short summary. I'm not quite sure what you mean about displaying text vs wiki markup. By default, {report-info} will escape any markup. It will only render it if you specify 'render=wiki'.
Hi David
Thanks for the reply.
Hi David Thanks for the reply. gives me text but the text contains the the formatting anchors or tags for e.g h2 and color Is it possible to get just text wihout any formatting tags? Thanks  gives me text but the text contains the the formatting anchors or tags for e.g h2 and color
Is it possible to get just text wihout any formatting tags?
Thanks
I am not sure why post are getting garbled
Ah - you want to strip out any wiki markup. There is nothing currently which would do that. I'm not certain how that would be achieved anyway. The only way I could think of is to render the text, then get only the 'text' portions of the resulting HTML. However, given that the HTML which is generated by Confluence and other macros is somewhat unreliable, it would have to be cleaned up first.
Whatever the case, it probably won't be an effecient process, even if it's implemented. But if you'd like to see it sometime, raise a feature request. No promises on when/if it will be implemented though.
Thanks I will do that .