Is there a way to list the newest pages?

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

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

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

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}

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>

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted Oct 24, 2018 in Confluence

Atlassian Research opportunity with Confluence templates

Do you use templates with Confluence? Take part in a remote 1-hr workshop. You'll receive USD $100 for your time!   We're looking for people to participate in a   remote 1-hr workshop...

1,118 views 17 14
Join discussion

Atlassian User Groups

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

Find a group

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

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you