It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Dead page, need the page ID to delete it

Kathleen James Mar 24, 2015

Working with Confluence 5.7.1. I have managed to kill a page through some recursive embedding (and/or my personal magnetic field). Regardless of the cause, the page is unreachable in the usual way. If I could find out the page ID, I could delete it and start over. 

I've searched for a macro to display the ID. I found various discussions but none of them worked: 

I tried building the macro on one of the pages (can't find that page again to link to it ... which is odd, was only just there a little while ago).  Nevertheless, here's the macro - sorry I can't acknowledge the author: 

 

## Macro title: pageid_edit                                                                                                                       
## Macro has a body: No                                                                                                                           
## Body processing: Use unprocessed macro body                                                                                                    
## Output: Generates Wiki Markup                                                                                                                  
##                                                                                                                                                
## This macro displays a View Page and Edit Page link                                                                                             
## for the space/page you specify. (These URL forms require                                                                                       
## a pageid, so this macro determines the pageid from the space/page.)                                                                            
## Useful when a page won't display, or when you need to view or edit                                                                             
## a large volume of pages (such as when you have a list of pages in                                                                              
## a text file or Excel spreadsheet).                                                                                                             
##                                                                                                                                                
## Params:                                                                                                                                        
##     space:   the space key                                                                                                                     
##     page:     the page title                                                                                                                   
## ----------------------------------------------------                                                                                           
#set ($wikibaseurl = "$action.getGlobalSettings().getBaseUrl()")                                                                                  
                                                                                                                                                  
#if ($paramspace)                                                                                                                                 
  #set ($spacekey=${paramspace})                                                                                                                  
#end                                                                                                                                              
#if ($parampage)                                                                                                                                  
  #set ($page=${parampage})                                                                                                                       
#end                                                                                                                                              
                                                                                                                                                  
#set ($pageid="{page-info:pageId|page=$spacekey:$page}")                                                                                          
                                                                                                                                                  
[View $spacekey:$page|$wikibaseurl/pages/viewpage.action?pageId=$pageid]  [Edit $spacekey:$page|$wikibaseurl/pages/editpage.action?pageId=$pageid]

I don't think that code is valid in this version of Confluence. It doesn't work anyway. I've tried Macro Body in all its permutations (no macro body, escaped, unrendered, rendered) and they all display the same way (wrongly).  

If I enter this: 

{pageid:space=KAT|page="My Page"}

then it does find the correct base URL but it simply displays last line of code in the macro with the addition of the parameters I entered like this: 

[View spacekey:KAT:My Page http://ourbaseurl.com/page/viewpage.action?pageID=$pageID]

Can anyone help with this, please? I really need to delete that page before users start trying to read it and complain that Confluence is dying. 

 

 

2 answers

1 accepted

0 votes
Answer accepted
Nic Brough [Adaptavist] Community Leader Mar 24, 2015

Ohh, there was a trick here when we worked together.  I wrote a user-macro that would list the immediate children of a page, with their IDs exposed.  I don't have it to hand, but it went something like

 

#set ($childpages=$content.getSortedChildren())
<table>
#foreach ($childpage in $childpages)
<tr><td>$childpage.getTitle</td><td>$childpage.getIdAsString()</td></tr>
#end
  
Then we temporarily stuck the macro on the page above the broken one, and got the ID from there.
Kathleen James Mar 24, 2015

I knew it had something to do with child/parent pages. Thanks, Nic. I'll give it a go.

Kathleen James Mar 24, 2015

Once again, whatever they're paying you isn't enough. :) That worked well enough -- the first column ( $childpage.getTitle ) didn't do anything, but the important bit worked beautifully. And I didn't even need to delete the page -- I managed to salvage it by removing the include page that was actually broken. /me Over the moon

Nic Brough [Adaptavist] Community Leader Mar 24, 2015

Oops. I think it should be getTitle(). I'll blame doing it from memory and lack of coffee ;-)

Kathleen James Mar 24, 2015

Well, I nearly fixed the lack of a </table> and then I thought, No. Best see what Nic's caffeine level is like before I start changing his code ;) and ... yes, it is getTitle() - now working perfectly.

Kathleen James Mar 24, 2015

Oh, and the correct setting for creating the macro is "No macro body"

0 votes
Kathleen James Mar 24, 2015

Found the original source of the macro: https://answers.atlassian.com/questions/7638

Suggest an answer

Log in or Sign up to answer
This widget could not be displayed.
This widget could not be displayed.
Community showcase
Published in Confluence

6 Awesome Ways to Apply Trello, JIRA and Confluence to your Project

I attended  Atlassian Summit 2019  and learned a lot from the presenters, attendees and knowledgeable Atlassian product managers. The presentations I attended focused on applying Agile, pla...

854 views 6 17
Read article

Community Events

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

Find an event

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

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you