Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Include content from Confluence in external website.

Christian Hammer January 7, 2020

Hi there,

we want to take some content from our confluence knowledge base and reuse it on our website so we don't have to edit it twice. On our website there are links like https://kb.xyz.blabla/x/eQrtBQ to out confluence instance.

My first attempt was as follows

  1. Let the browser load the page of our website containing one or more links to our confluence.
  2. Get all those links.
  3. Load that linked confluence pages and replace the Link-Element with parts of the loaded content. (Basically a JQuery.load() call).

Since the parts of the page where that content should have been shown aren't visible unless unfolded first. The little delay of loading two or three pages from confluence wouldn't have been a problem.

But! The problem here is, that confluence itself seems to load just a rudimentary page where content is replaced and added by Javascript after the page is loaded. So when I load the content all I see is "Generating page properties report..." and nothing happens because the headers and scripts of the confluence content are not "executed".

After that I tried to get the content via the REST API and inserted into the webpage before it is delivered to the browser. That would have been my preferred method anyway. But I have the same problem if I load the body. I get content like

<table class=\"aui metadata-summary-macro current_released_version\"
data-cql=\"label=&quot;current_released_version&quot; and space=&quot;BLABLA&quot;\"
data-headings=\"Status, Date, Summary\" data-first-column-heading=\"Title\" data-count-comments=\"false\"
data-count-likes=\"false\" data-total-pages=\"0\" data-page-size=\"30\" data-sort-by=\"null\"
data-reverse-sort=\"false\" data-blueprint-present=\"false\">
<caption>Generating page properties report...</caption>
<thead> </thead>
<tbody> </tbody>
</table>

 

Is there any way to get the content with all its links, macros etc. resolved before it is delivered?

 

Thanks

Christian

 

 

3 answers

2 accepted

0 votes
Answer accepted
Minh Tran
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
January 7, 2020

Hi @Christian Hammer

I don't believe we have an official way to do this from Confluence side. However, i think you can just use a frame or iframe from your website to include the Confluence page from another instance. One more thing, you probably need to allow Anonymous to access your page in this case

With this, you can have all content rendered 

I hope this helps

Thanks,

Minh

Christian Hammer January 8, 2020

Hi Minh,

thanks for your reply.

I thought about the same idea but rejected it as too much a performance hit for the page. But after a few thoughts, it isn't much of a difference than my original idea.

I'll try it now and hope for the best.

Thanks for thinking about the implications on access management. But fortunately all pages a open access and I won't have to deal with that.

Best regards

Christian

Like Minh Tran likes this
0 votes
Answer accepted
Sven Schatter _Lively Apps_
Atlassian Partner
January 7, 2020

Hi @Christian Hammer,

Is there any way to get the content with all its links, macros etc. resolved before it is delivered?

unfortunately, the simple answer to this is no.

There are certain macros (such as the Page Properties report, it seems) that will only render a placeholder on the server-side and do the actual work in the frontend. Using the REST API to get the rendered view is definitely the way to go here, but for your use cases you will need restrict yourself to macros that render on the server-side.

This means you also probably can't use a lot of third party macros / apps that do this, unless they provide an option to choose between synchronous rendering during macro execution time and asynchronous rendering trough the frontend. E.g. our app PocketQuery has a macro option called "load dynamically" which lets you toggle this exact behavior. So when using app macros watch out for options like this.

From a technical standpoint someone could implement a Servlet on the Confluence Side that renders a page but without the navigation, sidebar, etc. (so, just the content) which could then be used in an iframe on your web page. Maybe there's even already something like that on the Marketplace.

For example, I haven't tried this app myself, but from a quick glance it looks like it could be worth checking out for you: https://marketplace.atlassian.com/apps/1217536/embedder-for-confluence?hosting=cloud&tab=overview EDIT: Ignore this suggestion, I just noticed you're on Server and this app is for Cloud. But you should probably still spend a few minutes looking on the Marketplace if you can find something like this. :)

Best regards,
Sven

Christian Hammer January 8, 2020

Hi Sven,

thanks for your reply. Since we are looking for a not too "confluency" solution, I'll try the iframe idea posted by Minh Tran below first and hope it won't be too much a performance hit when we cache the result.

Best regards

Christian

1 vote
Christian Hammer January 8, 2020

Since I don't know where else to put this, I post it here:
This was my first question in this forum and I got two quick, technically sound and kind answers. No ranting, no insults. Nice to see, that these kind of forums still exist. Thanks!

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events