Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
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

Adding Internal Links Using REST API

Edited

Hello,

I am updating the content of the page by giving the update function the whole html code. Everything is working perfectly, except for <a> tags that need to be linked to existing pages in confluence. I updated the href attribute to meet the url of the internal page to be linked to like

'/wiki/spaces/spacekey/pages/pageid'

and added  the attributes that I found I should be adding to link this <a> tag to the page properly, which are 

data-linked-resource-id

data-linked-resource-version

data-linked-resource-type

So, the <a> tag I am inserting looks like this:

<a href="/wiki/spaces/spacekey/pages/pageid" data-linked-resource-id="targetpageid" data-linked-resource-version="targetpageversion" data-linked-resource-type="page">Page Name</a>

However, after the update is done successfully, I check the updated page html to find out that only href is updated successfully, while all the other attributes are ignored, and a new rel attribute is added. It looks like this:

<a href="/wiki/spaces/spacekey/pages/pageid" rel="nofollow">Page Name</a>

Is there a way to force adding these attributes that are being ignored? Or is there another proper way to insert <a> tags linking to internal pages in confluence?

Thank you.

1 answer

0 votes
Pramodh M Community Leader Dec 31, 2021

Hi @Hani Suliman 

Use the below link for reference to add the reference in the same page using anchor tags

https://community.atlassian.com/t5/Confluence-questions/How-to-link-to-headings-on-the-same-page-new-editor/qaq-p/1250592

Thanks,
Pramodh

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
FREE
TAGS
Community showcase
Published in Confluence Cloud

🏠 Say hello to the new Confluence Home!

Hi Atlassian Community, My name is DJ Chung, and I’m a Product Manager on the Confluence Cloud team. Today, I’m excited to share a new and improved version of Home. The new Home helps you ...

39,330 views 28 127
Read article

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