Forums

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

Create a page that contains a filtered list of pages

Mark McCrone May 21, 2018

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

 

2 answers

0 votes
Mark McCrone June 4, 2018

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>

0 votes
Patrick Cartier [Candylio]
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.
May 21, 2018

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

Mark McCrone May 21, 2018

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

Victor Mutambuki
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.
May 21, 2018

Mark,

Are you using the Page Properties and Page Properties Report macro?

Both must be used together.

Victor

Mark McCrone May 21, 2018

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

Victor Mutambuki
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.
May 21, 2018

mark,

If that's the case, patrick's suggestion would be plausible.

Victor

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events