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

migrate html content into confluence

Ray DR February 19, 2015

I am trying to migrate an old Knowledge Base into Confluence but I can only get the content as HTML files inside of an SQL dump.
Is there any way I can migrate all of the articles in the SQL dump into a Confluence space?
I have tried UWC but it does not recognize SQL DB's.

2 answers

0 votes
Bob Swift OSS (Bob Swift Atlassian Apps)
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.
February 20, 2015

It depends on how you want the HTML content retained and whether it is a one time import. There are a few choices.

  1. Create pages with the HTML content imbedded in an html macro. Either use the system supplied html macro (must be enabled) if you only have trusted users on your site or use the HTML Macro included with HTML for Confluence that can be secured with Macro Security for Confluence. You can use the Confluence SOAP or REST apis to create the page content if you have those skills or use storePage from Confluence Command Line Interface (CLI)
  2. Put the files in the file system so they can be referenced by the HTML Macro (can't use the built-in html macro) and then create your pages as in 1) except the page content would just be a single HTML Macro with no body that references the file as a parameter.
  3. Attach the files to Confluence. For instance, using addAttachment from Confluence Command Line Interface (CLI). Do the same as 2), except reference the attachment instead of the file system.
  4. If your html is really clean (well formatted) and you only need to do the import once, you might be able to import it directly into a page (without using html macro) using storePage with the noConvert option. 

 

Ray DR February 20, 2015

I am glad to hear I have some options. I will look into these. Thanks!

0 votes
Alex Medved _ConfiForms_
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.
February 19, 2015

Hi,

How I would approach this problem:

  • Will extract the HTML content from the SQL dump into files and will create the directory structure I want/need
  • Will create an empty new space in Confluence
  • Will write a simple script that will traverse the files and will use Confluence REST API to import each file as new page https://docs.atlassian.com/confluence/REST/latest/#d3e865

A little bit of work, yeah... but not that complicated wink

Ray DR February 20, 2015

Thanks! I will check this out. So how will this work if I have a template in the Confluence space I want to use so all articles are organized in the same way? I know that all new articles going forward will use the template but I am not sure if an import can be told to use a template format.

Alex Medved _ConfiForms_
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.
February 20, 2015

So, you get your Template as HTML and merge it with the HTML from the file and use the merged result to put it inside confluence (via rest api as mentioned earlier)

Ray DR March 5, 2015

How would I tackle the first bullet you listed (extract the HTML content from the SQL dump)?

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events