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

Is there a way to list the newest pages?

Bob Nicholson September 27, 2012

Looking for a macro, or some way of displaying a list of pages in reverse order of creation (newest pages first).

It would be great if I could do the same thing by modification date.

3 answers

1 vote
SarahA
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 27, 2012

Hallo Bob

The Recently Updated macro shows the most recently added and updated content:

https://confluence.atlassian.com/display/DOC/Recently+Updated+Macro

Alternatively, you can build an RSS feed:

https://confluence.atlassian.com/display/DOC/Using+the+RSS+Feed+Builder

And then use the RSS macro to show the feed on a Confluence page:

https://confluence.atlassian.com/display/DOC/RSS+Feed+Macro

Neither of the above solutions will separate the new pages from the updated pages.

I hope this helps!

Cheers, Sarah

0 votes
MatthewC
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 27, 2012

and as a bonus extra! if you fancy using a user macro, this will create a table in the page of all the pages in the current space. You can then click on the column labels to order by the that value (ID, Name, Creator, Created, Modified, Modifier)

## Macro title: Created Page Report
## Macro has a body: N
## Body processing: No Body
## Output: HTML
##
## Developed by: Matthew Cobby - mat@andamooka.com

## @noparams

#set($pages=$pageManager.getPages($space, true))
<p>Num pages: $pages.size();</p>
<table id="spacepagereport">
<thead><tr class="spacepagereport_row"><th><a href="#" id="pageIdCol">ID</a></th><th><a href="#" id="pageNameCol">Page</a></th><th><a href="#" id="creatorCol">Creator</a></th><th><a href="#" id="createdCol">Created</a></th><th><a href="#" id="modifierCol">Modifier</a></th><th><a href="#" id="modifiedCol">Modified</a></th></tr></thead>
<tbody>
#foreach ($page in $pages)
   <tr><td>$page.getIdAsString()</td><td><a href="/pages/viewpage.action?pageId=$page.getIdAsString()">$page.getDisplayTitle()</a></td><td>$page.getCreatorName()</td><td>$page.getCreationDate()</td><td>$page.getLastModifierName()</td><td>$page.getLastModificationDate()</td></tr>
#end
</tbody>
</table>
<script>
AJS.toInit(function(e) {
#########################
## Sort by Page ID
#########################
   AJS.$("#spacepagereport #pageIdCol").click(function(e) {
      var rows = AJS.$("#spacepagereport tbody tr").get();
      rows.sort(function(a, b) {
      var A = AJS.$(a).children('td').eq(0).text();
      var B = AJS.$(b).children('td').eq(0).text();
      if(A < B) {return -1;}   
      if(A > B) {return 1;}      
      return 0;});
## required to stop velocity parsing the "$.each(rows,", create the code as a var & print out to end HTML
#set($varHack='AJS.$.each(rows,function(index, row) { AJS.$("#spacepagereport").children("tbody").append(row);});')
   $varHack
   e.preventDefault();
   });
#########################
## Sort by Page Name
#########################
   AJS.$("#spacepagereport #pageNameCol").click(function(e) {
      var rows = AJS.$("#spacepagereport tbody tr").get();
      rows.sort(function(a, b) {
      var A = AJS.$(a).children('td').eq(1).text().toUpperCase();
      var B = AJS.$(b).children('td').eq(1).text().toUpperCase();
      if(A < B) {return -1;}   
      if(A > B) {return 1;}      
      return 0;});
## required to stop velocity parsing the "$.each(rows,", create the code as a var & print out to end HTML
#set($varHack='AJS.$.each(rows,function(index, row) { AJS.$("#spacepagereport").children("tbody").append(row);});')
   $varHack
   e.preventDefault();
   });
#########################
## Sort Creator
#########################
   AJS.$("#spacepagereport #creatorCol").click(function(e) {
      var rows = AJS.$("#spacepagereport tbody tr").get();
      rows.sort(function(a, b) {
      var A = AJS.$(a).children('td').eq(2).text().toUpperCase();
      var B = AJS.$(b).children('td').eq(2).text().toUpperCase();
      if(A < B) {return -1;}   
      if(A > B) {return 1;}      
      return 0;});
## required to stop velocity parsing the "$.each(rows,", create the code as a var & print out to end HTML
#set($varHack='AJS.$.each(rows,function(index, row) { AJS.$("#spacepagereport").children("tbody").append(row);});')
   $varHack
   e.preventDefault();
   });
#########################
## Sort by Created
#########################
   AJS.$("#spacepagereport #createdCol").click(function(e) {
      var rows = AJS.$("#spacepagereport tbody tr").get();
      rows.sort(function(a, b) {
      var A = AJS.$(a).children('td').eq(3).text().toUpperCase();
      var B = AJS.$(b).children('td').eq(3).text().toUpperCase();
      if(A < B) {return -1;}   
      if(A > B) {return 1;}      
      return 0;});
## required to stop velocity parsing the "$.each(rows,", create the code as a var & print out to end HTML
#set($varHack='AJS.$.each(rows,function(index, row) { AJS.$("#spacepagereport").children("tbody").append(row);});')
   $varHack
   e.preventDefault();
   });
#########################
## Sort by Modifier
#########################
   AJS.$("#spacepagereport #modifierCol").click(function(e) {
      var rows = AJS.$("#spacepagereport tbody tr").get();
      rows.sort(function(a, b) {
      var A = AJS.$(a).children('td').eq(4).text().toUpperCase();
      var B = AJS.$(b).children('td').eq(4).text().toUpperCase();
      if(A < B) {return -1;}   
      if(A > B) {return 1;}      
      return 0;});
## required to stop velocity parsing the "$.each(rows,", create the code as a var & print out to end HTML
#set($varHack='AJS.$.each(rows,function(index, row) { AJS.$("#spacepagereport").children("tbody").append(row);});')
   $varHack
   e.preventDefault();
   });
#########################
## Sort by Modified
#########################
   AJS.$("#spacepagereport #modifiedCol").click(function(e) {
      var rows = AJS.$("#spacepagereport tbody tr").get();
      rows.sort(function(a, b) {
      var A = AJS.$(a).children('td').eq(5).text().toUpperCase();
      var B = AJS.$(b).children('td').eq(5).text().toUpperCase();
      if(A < B) {return -1;}   
      if(A > B) {return 1;}      
      return 0;});
## required to stop velocity parsing the "$.each(rows,", create the code as a var & print out to end HTML
#set($varHack='AJS.$.each(rows,function(index, row) { AJS.$("#spacepagereport").children("tbody").append(row);});')
   $varHack
   e.preventDefault();
   });

 });
</script>

0 votes
MatthewC
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 27, 2012

You could use either the SQL macro and Run macro & a SQL query to the database or the Customware Reporting plugin. I can post a couple of examples later if you think it would be of use?

http://wiki.customware.net/repository/display/AtlassianPlugins/Reporting+Plugin

MatthewC
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 27, 2012

Right, sorry about that delay had some things to do ;-)

here's a solution using the Customware Reporting plugin, set to max 20 results, using the current space. created date descending.

{report-block:maxResults=20}
{content-reporter:type=page|space=@self}
{text-sort:content:space > space:name}
{date-sort:content:creation date|order=descending}
{content-reporter}
{report-body}
{report-info:content:title|link=true} in {report-info:content:space|link=true}, last modified {report-info:content:modification date}
{report-body}
{report-block}

and the same by modification date

{report-block:maxResults=20}
{content-reporter:type=page|space=@self}
{text-sort:content:space > space:name}
{date-sort:content:modification date|order=descending}
{content-reporter}
{report-body}
{report-info:content:title|link=true} in {report-info:content:space|link=true}, last modified {report-info:content:modification date}
{report-body}
{report-block}

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events