Integrating Confluence into a website.

By
Scott Willan
January 17, 2017


Before you start looking at how you want to integrate Confluence into your site, ask yourself why you want to integrate Confluence into your site. If it’s a single functionality Confluence has that you want, there will be many other options. Building your own functionality may even be the best option. There are many reasons you may want to incorporate Confluence into your own product solution. My reason was to see if it could be used as a knowledge base for a product we are developing. Everything has a cost whether it’s time or money. Just keep in mind which one you are more willing to spend. I’m not your mother so I won’t tell you what to do; I’ll just give you a few options instead.
Through my research journey, I have found a number of options for accomplishing this task. This blog is a summary of my initial findings and observations.
First up on the list is using the Confluence API to scrape the content and display it as you need. This method is flexible but difficult and complex. The advantage is you can do whatever you want with the information returned. The Confluence API is a REST API which returns JSON data, which is great for flexibility as a developer. The downside is there will be a lot of issues with the linking of content as the links returned will be for inside the Confluence domain. Scraping content with an API can be like scraping the toppings off a round pizza to put on a square pizza base. Sure, if you take your time and do it carefully you end up with exactly what you want. But you can easily end up out of your depth with cheese all over your fingers. If you want to dump all your content onto a few pages, or you only have a few pages to deal with in the first place, this might be what you’re looking for.
Next up is the ever-simple iframe. If you have worked with iframes before, you will probably be familiar with SOP (Same-Origin Policy). This is when a website does not allow its content to be embedded in a page with a different domain to its own. A tip for testing iframes: Bing.com does not care about Same-Origin Policy. This means you can put it in an iframe for quick testing. So that’s iframes ruled out then? Well no, but yes. There are workarounds you can use. Most of these revolve around the use of JSONP (JSON with Padding). But doing so seems to leave you vulnerable to cross-site scripting. So for me, using an iframe was a no.
This brings us to the third option, which I believe is outdated. CLI (command line interface) is an option I came across in my research. This option seemed to be more prominent in older versions of Confluence. CLI is aimed more towards scripting and not towards the code based requirements I have. If CLI sounds like what you are looking for, Bob Swift has a lot of information on the matter.
There is one more option we have. It is also the simplest of the solutions. Instead of embedding or integrating Confluence, we can just re-skin it or add a theme to it, then link to the external page. This may not be the most satisfying option, but it will be the easiest and will get the job done. In order to make this option viable in a cost aspect, you may want to set your space to public as this does not require customer licensing. This will allow anyone to view your content but will help to maintain a fluid UX by not having to sign in. I have come across two ways to alter the look and feel of your Confluence space. I would not advise undertaking either task without previous CSS and HTML knowledge. With both approaches, you have the option to apply styling to separate spaces or globally. However, you cannot edit the admin page due to security precautions. The first way to do it is manual. Confluence offers tools for admins that allow you to edit the look and feel of your Confluence spaces. This has the added benefit of being a free and permanent solution. The downside is that it seems to have less flexibility than the alternative option.
If you do not like the idea of editing Confluence using their native tools, you can easily find a plugin. One such plugin I found was Adaptavist’s Themebuilder for Confluence. Themebuilder seems to allow for more flexibility than Confluence’s built-in tools. It is also an Atlassian trusted plugin for added compatibility reassurance.
Security is something I have yet to delve into. To create a seamless application you will need to set pages to public or enable some form of SSO (single sign-on). Setting Confluence spaces to public removes all access control, while using the API keeps the security. But the API now has the setback of tailoring and distributing information to specific users or user groups. Public Confluence spaces are cheap as there is no added cost for the users. But if you want secure content, users will need Confluence accounts which are another added cost. Using the API only requires one super user for you to access the secured content in Confluence.
Useful resources:


Scott – From hard data to fluid design

Scott blogs about how design and making things look good no matter if its a website or data. He is great at making data consumable and therefore valuable.

Connect with Scott on LinkedIn or read his other blogs here.

Copyright © 2019 OptimalBI LTD.