Hello.
I'm writing a custom macro for Confluence that lists all of the outgoing links on a page. I want it to look like this mockup:
So far, I'm requesting the content of the body of the page, and storing the url properties of all InlineCard objects in an array.
I would like to render the links in my macro in the same "smart link" style as the InlineCards in the body if possible. But I can't find any documentation on how to achieve this. Is this possible at all?
Take a look at the rendered HTML from the InlineCards. It may be as simple as reusing the CSS class (and imitating the structure).
My problem is that, the page's content retrieved by running
api.asUser().requestConfluence(route`/wiki/rest/api/content/${contentId}?expand=body.atlas_doc_format`);
contains the InlineCard objects, which have this structure:
{ "type": "inlineCard", "attrs": { "url": "https://atlassian.com" } }
The objects contain the property for the URL which they point to, but no property for the page title. To be able to build a list of hyperlinks with the URL + the title of the page they point to, I would have to request the page data using each URL I stored, and pull the page title/icon from that. This is presumably just what InlineCard does in the backend, so I would be effectively rewriting what InlineCard does already, which I would prefer not to do, but if there's no sort of API or library I could find for this, then I will likely have to go that route!
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.