Can I store metadata in HTML tags in Confluence?

Hello! I am creating pages on Confluence programmatically using the REST API. I need to store some tables that I need to retrieve (using an XML parser) and update later. In order to tell which table is which, I am trying to store attributes to the HTML tags in Confluence, but Confluence seems to drop them when saving the page content.

For example, when I send Confluence this

<tbody tid="a-very-specific-table">
	...
</tbody>

Confluence accepts it but later on when I retrieve the page the table drops the attributes I gave it:

<tbody>
	...
</tbody>

 

Is there a way to store my own attributes or otherwise tag a table with some metadata so that I can retrieve it later?

Many thanks in advance!

2 answers

Hi,

What if when you create you page, you try to wrap your custom attributed tables in a HTML macro

<ac:structured-macro ac:name="html">
<ac:plain-text-body>
<![CDATA[
 
TABLE here
 
]]>
</ac:plain-text-body>
</ac:structured-macro>

will this work or still will strip-off your custom attributes?

My XML parser would not even allow me to do that in the first place because it's missing Confluence's namespace and XML descriptions. Even when I try to parse a confluence page that has <ac:...></ac:...> tags in it, it strips them off. (https://answers.atlassian.com/questions/11455197/)

just wrap it as string value before sending to REST API... you do not have to work with this as with XML. or the actual problem is with reading it back?

well, I need to parse it as XML first, edit it, then stringify and put it back. It's meant to be a programmatically updated page.

0 vote
Davin Studer Community Champion Dec 11, 2014

This is not ideal, but you could try something like this and I think it should work.

&lt;div&gt;
	&lt;span style="display: none;"&gt;
		meta data here.
	&lt;/span&gt;
	&lt;table&gt;
		...
	&lt;/table&gt;
&lt;/div&gt;

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Posted Jul 10, 2018 in Confluence

We want to see the templates you've created in Confluence!

Hi Community, Jessica here from the Confluence Product Marketing team!  July’s community challenge is all about sharing pictures  — and as an extension of our first post on what ...

743 views 21 12
Join discussion

Atlassian User Groups

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

Find a group

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

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you