It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Need to add pagination to content by label macro

Please  help, I am new to confluence and need to add pagination to my dynamic pages which are created by using content by label macro.

Is there any code out there with an example of what needs to be done to add pagination to the content by label macro? 

Do I need to create a new user macro? 

1 answer

0 votes

Karina,

The Content by Label macro does not create pages, but rather inserts a macro into your existing page that displays all content in Confluence with a label you specify.

By default, this will show up to 15 pages but can be increased up to 500. There is pagination at the bottom of this macro in order to help you navigate.

If you are dynamically generating pages that contain the Content by Label macro, we'll need to know the process you are using to accomplish this, in order for us to know how to tell you to paginate your results.

Regards,

Shannon

I am using a label to create my dynamic pages sorted by creation date I am displaying excerpts from different pages with the same label.

If I select to show just 15 excerpts of the query how can I add a page ribbon or next/previous buttons to view the next 15 excerpts on another page?

I need a pagination ribbon or next/ previous button to go to the next 15 excerpts of the content by label query. 

If I have 100 documents and I want to show 15 documents per page, I need a way to get to the next 15 documents using pagination.

Karina,

How exactly are you using the label to create dynamic pages? Is there a script or add-on that you're using?

It's not clear from your description what we're working with here, so please provide more details about this setup and what exactly you did to get this to work.

It sounds like it was something developed in-house, and you might need to speak to the same team who created this in order to add pagination.

Regards,

Shannon

I think what I am calling dynamic pages are confusing you,so forget i mentioned dynamic pages. I am adding a label video to each of the stories that have been created and then use the content by label macro to pull in excerpts from each of these stories. The page, the content by label macro is on shows 15 story excerpts. I need a page ribbon or a button at the end of this page to show the next 15 story excerpts on another page. I don't want to have all excerpts listed on one page, I want a page ribbon or next/previous link  so I can go to the next 15 story excerpts that have the label video.

2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 NEXT >>

Karina,

I see; so to verify, you are splitting your Content by Label results across several pages rather than one page, so the pagination results on the macro itself isn't useful for you.

The main thing I would recommend, which you've probably already done, is have one parent page that collects these pages, and each page with a CBL macro is a child of that page.

You could then use a similar solution to the threads below:

Unfortunately the Next and Previous Links document that is referenced in the second link is no longer available, but you should have the basic idea.

Essentially, you'll need to write a User Macro to accomplish this.

 

It might also be worth checking out our Marketplace Apps, in case there are any navigation add-ons available to accomplish your requirement.

Regards,

Shannon

@Shannon_Spaniol I have a question about 

By default, this will show up to 15 pages but can be increased up to 500. There is pagination at the bottom of this macro in order to help you navigate.

Italic emphasis added by me.

I can certainly see in the macro edit where I can control the number of things but don't see anywhere to control or enable pagination or any navigation within the results.  The feature you're describing isn't referenced in the Content by Label Macro documentation that I can see. Is it specific to a particular version or just to cloud instances?

Hello Sean,

This is a bit of an older thread, but I made a mistake in interpreting what the macro does, and I've not been able to test this myself as I don't have a Confluence instance that has that many pages in it which are labeled.

The pages that it displays are actual Confluence pages. So, if you want to display 500 pages of Confluence that use that label, the functionality mentioned in Content by Label Macro documentation is the one you change:

Maximum Number of Pages

Limit the number of items to include in the list. This can be any value up to 500 pages.

This does not include pagination, as I am now learning. If you want to add pagination you would need to try editing the macro, if you are comfortable with modifying source code. There's one solution here you can try:

If you still have any issues, I recommend raising a new question, and our Community can help with that. I don't personally have experience with modifying the built-in macros in this way, but I know a lot of our community has and would be able to help you with that.

Regards,

Shannon

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Posted in Confluence

What project did you transition or start on Confluence with the shift to remote work?

It’s been great to hear from fellow users over the last few weeks about the best tips and fun moments you’ve had working on Confluence since the transition to working remote. I’d love to keep the c...

32 views 2 4
Join discussion

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you