Thursday, March 8, 2012

Show the Content ID of a Page

The following instructions are based on Jeremy Largman's instructions. To view the content ID of a page, complete the following procedures. NOTE: you must be a Confluence admin to add a new user macro.
  1. Go to Browse > Confluence Admin > User Macros.
  2. The Create a User Macro section opens.
  3. Press the Create a User Macro button.
  4. Enter a name in the Macro Name text field. (Something like "pageid.")
  5. Enter a title in the Macro Title text field.
  6. Under the Definition of User Macro section, verify that the No macro body radio button is selected.
  7. Select HTML from the Output Format dropdown.
  8. Enter the following in the Template text box.
    $content.getIdAsString() 






















  9. Press the Save button.
  10. Edit a Confluence page.
  11. In the area you wish to see the page ID, type:
    {<macro_name>}
    For example: {pageid}

Page Unavailable, Can't Edit or Delete

This week I selected a page link in Confluence and received a server error. I could not view, edit or delete the page. I thought if I knew the page ID, I might be able to enter the appropriate edit URL. But I didn't know the page ID.

I looked around on the Internet and found Jeremy Largman's user macro, but I couldn't edit the page to add the macro. Finally, I found the correct procedures from Atlassian: Editing or Deleting a Page That Won't Render.

Page ID
Ultimately, I had to ask our admin to retrieve the page ID from the database. He was able to do so by running the following command against the database:
select contentid from CONTENT where title = '<page_name>' and version = '1';

Edit URL
Once I had the page ID, I entered a URL similar to the following in my browser's address bar:
http:///pages/editpage.action?pageId=<page_ID>
Other edit options include pressing the Ctrl + e keys or accessing the edit URL that includes the page name. For example:
http:///pages/editpage.action?spaceKey=<space_key>&title=<page_name>

Delete URL
To delete the page, try:
http://<base_url>/pages/removepage.action?pageId=<page_ID>

Other Commands

Here are some other commands that may be useful.

Edit blog post:
http://<base_url>/pages/editblogpost.action?pageId=<page_ID>
 
View attachment:
http://<base_url>/pages/viewpageattachments.action?pageId=<page_ID>
 
Delete attachment:
http://<base_url>/pages/removeattachment.action?pageId=32787&fileName=harbour.jpg&version=1
 
Retrieve wiki markup from database:
select body from bodycontent where contentid in (select contentid from CONTENT where title = '<page_name>');

Monday, September 26, 2011

Column Width Not Working

Recently, I tried to define the width of a column as such:

{section}
{column:width=400px}
Cell 1A
{column}
{column:width=400px}
Cell 1B
{column}
{section}

However, Confluence would not recognize the defined widths. After spending hours trying to figure out the solution, I found a JIRA ticket that provided a workaround—add a blank column at the end of each section.

{section}
{column:width=400px}
Cell 1A
{column}
{column:width=400px}
Cell 1B
{column}
{column} {column}
{section}

Thanks to Tomi Strugar for the workaround.

Thursday, September 22, 2011

Add a Site-wide Banner

To add a site-wide banner to Confluence:
  1. From the Browse dropdown, select Confluence Admin.
  2. The Administration Console page opens.
  3. Locate the Look and Feel section toward the middle-left of the page.
  4. Select Custom HTML.
  5. The Custom HTML page opens showing the Insert Custom HTML table.
  6. Press the Edit button at the bottom of the table.
  7. In the At Beginning of the Body text box, enter code similar to:
    • <!-- Message Banner -->

      <div style="background-color: gold; border: 2px solid red; margin: 4px; padding: 2px; font-weight: bold; text-align: center;">

      Enter message here.

      </div>















  8. Press the Save button.
________________________________________________________________

TIP! When you no longer need the banner, comment it out instead of deleting it from the table.

Additional information can be found here.

Tuesday, August 2, 2011

Add Image to PDF Export

To add an image to your PDF export in the title page, header or footer:
  1. Access the appropriate space.
  2. Attach the image to a page in the space.
  3. Click the image's name link.

















  4. The image opens in a new window.
  5. Copy the image's URL starting with /download/.

    For example:
    /download/attachments/107675675/PDFLayout.png

  6. Access the space's PDF Layout page by going to Browse > Space Admin > PDF Layout.
  7. Press the Edit button. 
  8. In the title, header or footer section, enter code similar to: 

  9. <img src="/download/attachments/107675675/PDFLayout.png"/>

  10. To center the image and set a top margin and page break, use:

  11. <div style="text-align:center; margin-top:35mm; page-break-after:always;"><img src="/download/attachments/107675675/PDFLayout.png"/></div>























  12. Press the Save button.
________________________________________________________________

See the Editing the PDF Stylesheet page for more information.

Friday, July 29, 2011

Add Page Numbers to a PDF Export

To add page numbers to a PDF export, enter the following code in the PDF Stylesheet:

     #pageNum:before
     {
     content: counter(page);
     }




















Access the PDF Layout section.























Enter code similar to following in the PDF Space Export Header or PDF Space Export Footer section of the PDF Layout:

     <div style="text-align:right;"><span id="pageNum"/></div>























To edit the PDF Stylesheet page, open the space then go to Browse > Space Admin > PDF Stylesheet > Edit button.

To edit the PDF Layout page, open the space then go to Browse > Space Admin > PDF Layout > Edit button.

________________________________________________________________

See the Editing the PDF Stylesheet page for more information.

Tuesday, July 26, 2011

Remove TOC from PDF Export

To remove the table of contents from your PDF export, enter the following code in the PDF Stylesheet:

     div.toc
     {
     display: none;
     }

To edit the PDF Stylesheet page, open the space then go to Browse > Space Admin > PDF Stylesheet > Edit button.