How to pull all links from certain pages onto a single page
Asked by Hannah Kahler:

I am currently using Excerpts macros to populate a single page with the links from numerous other pages. On the individual pages I have an Excerpt macro that people paste their links into, and then on the collated page, I use the Include Excerpt macro from each of those pages.

I am wondering if there is a faster/easier way to do this so that I do not have to know the name of every page and include that excerpt on my page (because hypothetically I could end up with 50+ pages that I want to collate the content of). For instance, could each of the individual pages use a label and then I can pull just the links from pages with that label and populate a list of links on my collated page? I do not want to use Content by Label because that pulls the name of the page with a brief look at the page and then you have to navigate to the page to see everything - I want to be able to see all links from the individual pages right there on my collated page. I am happy to use a query or some other back end way to do this if there isn't an easy macro. I also don't need the links to come in in any organized way -- it could just be a running list that I then have to move around/organize/apply IA to.

I'm trying to limit the amount of work each team needs to do on their individual page to allow me to see their links on my collated page. Thanks!


Answers:
author: Robert Reiner _smartics_
body: You could use a query and render the excerpts (transclusions) from the result list. The [projectdoc Toolbox](https://www.smartics.eu/confluence/x/1YEp) (I'm one of the authors) has the [Transclude Documents Macro](https://www.smartics.eu/confluence/x/7ADe) to do this.

Specify [document properties](https://www.smartics.eu/confluence/x/OQNk) with the [Document Properties Marker Macro](https://www.smartics.eu/confluence/x/rgNk) and use the macro select on the documents to transclude. You may transclude properties or [sections](https://www.smartics.eu/confluence/x/ugNk) (or parts of a page marked with the [Content Marker Macro](https://www.smartics.eu/confluence/x/vANk)).

For instance: Fetch all Description and References sections from documents with a Tag 'Info' and Experience Level 'Expert'.

For more information on this topic in the context of the add-on:

* [Content Reuse](https://www.smartics.eu/confluence/x/qQdwAg)
* [Transclusion](https://www.smartics.eu/confluence/x/zoQoAg)
* [Online Manual](https://www.smartics.eu/confluence/x/EAFk) :)

The projectdoc Toolbox is a commercial add-on for *Confluence Server* and is [available on the Atlassian Marketplace](https://marketplace.atlassian.com/1212629).

comments: author: Hannah Kahler
body: Thank you, Robert!

Would this also be the easiest way to populate a single page with all \*links\* from pages with a certain label?

So -- pages A, B, and C have the label "research" and they each have numerous links on them that either link to other confluence pages or link externally to google docs and websites.

I want page D to have all of the links from A, B, and C on it.

Thanks!


author: Robert Reiner _smartics_
body: Sorry, this only solves the problem that you do not need to know the name of every page (and every section) you want to transclude from. I assumed that the links are already in containers that you want to grab. The transclusion just makes the content of these containers (independent of their content) visible in one page.

You could - for example - have sections on pages A, B, C with and without links. If the sections with links are tagged 'link' (or something approprite to your use case), you could transclude only those sections. You could also enclose each link in a content element to make it accessible with the transclusion macro, but I assume that is impractical for the users that need to add the link.

There is no automation that just collects the links (something like fetching all 'a' elements from an HTML page) with our transclusion macros. I also do not know any tool that would do this on Confluence. You could have a look at our [HTML Snippet Macro](https://www.smartics.eu/confluence/x/TIJ4Ag) that allows to extract content with a JSoup expression. Its use case is to fetch an HTML element from a remote server (such as a report that is made available on an internal server, no password required - currently), but may also serve your use case to some extend (but you would need to specify the source pages manually - or you have a transclusion page and then fetch your links from that ...). This is more a hack-if-nothing-else-works (and maybe not even then ...).


author: Hannah Kahler
body: Ok, thank you!