Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,465,038
Community Members
 
Community Events
176
Community Groups

Rendering an InlineCard in a custom macro

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:

chrome_r9vwaKO7Wx.png

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?

1 answer

0 votes
Bill Bailey Community Leader Jul 29, 2022

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!

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
FREE
PERMISSIONS LEVEL
Site Admin
TAGS

Atlassian Community Events