I'm working with a knowledge base built in Confluence.
I can create a page that contains a filtered list of links to articles, using the Page Properties Report macro
I want to create a page that contains the content of the articles
Any suggestions gratefully received
Thanks for taking the time to look at this
One of my colleagues resolved this using the Rest API and some JavaScript
function populateDescription(body){
<!-- the body comes from the rest API and represents one article -->
<!-- process the body and convert it to a string representing a sanitised table ->
<!-- return the string -->
}
function getOnload2(){
AJS.$.ajax({
url: "https://[SERVER]/confluence/rest/api/content/search?... ",
type: 'get',
dataType: 'json',
async: false,
success: function(response) {
var html = ... <!-- set up div and outer table-->
jQuery(response.results).each(function() {
title = this.title;
body = this.body.view.value;
html += "<tr>";
html += "<td class=\"confluenceTd\">" + title + "</td>";
html += "<td class=\"confluenceTd\" width=75%>" + populateDescription(body) + "</td>";
html += "</tr>";
html += '</tbody></table></div>';
html += '</tbody></table></div>';
<!-- add the new list of tables to the report div -->
AJS.$('#Report').append(html);
<!-- hide the loading message -->
AJS.$('#LoadingMsg').css("display","none");
}
AJS.toInit(function () {
getOnload2();
});
<div id="Report">
<span id="LoadingMsg">Loading table...</span>
</div>
Hi @Mark McCrone,
You want to create a page that includes all of the content of each article that you choose?
If so one option could be the excerpt macro on the original page with the excerpt include macro on the page you want to display the content.
Here is some documentation on the macros:
https://confluence.atlassian.com/doc/excerpt-include-macro-148067.html
https://confluence.atlassian.com/doc/excerpt-macro-148062.html
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi
Thanks for taking the time to look at this
I've tried that and I would have to create a static excerpt link for each article I want to include and update my page every time a new article is created or deleted
What I'd like is something dynamic, similar to the Page Properties Report but that displays the content
As a side issue, none of the existing articles have excerpts defined so I would have to edit several hundred articles
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Mark,
Are you using the Page Properties and Page Properties Report macro?
Both must be used together.
Victor
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Victor
Thanks for this
We are already using Page Properties along with the Page Properties report macro to get a list of articles.
I don't exactly want a Page Properties Report though because that would give me one row per article, in a table
I'd like to create a dynamic page that had the actual content of the article embedded within it
So
Article 1 Title
Article 1 Content
Article 2 Title
Article 2 Content
If someone creates Article 3, then that is automatically added to the page
The ultimate aim is to create a customised page of articles that can be converted to a PDF and be sent to a client, who won't have access to our internal confluence server
Cheers
Mark
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
mark,
If that's the case, patrick's suggestion would be plausible.
Victor
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.