Dead page, need the page ID to delete it

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
Accepted answer

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.

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

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

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

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.

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

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

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Nov 29, 2018 in New to Confluence

How to use Confluence Cloud for stakeholder management

Most of us don’t need much convincing that stakeholder management is important. It just makes sense that keeping everyone in-the-know on projects and assigning clearly defined roles is key to having ...

1,144 views 4 6
Read article

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