Scaffolding and TOC

Hello,

I'm using Scaffolding with textareas for headers.

The Toc macro show the titles but in the area of scaffolding even in the view mode.

Is their a way to have a table of anchor in the page using scaffolding ?

(my question is close from : https://answers.atlassian.com/questions/1974/scaffolding-and-toc)

2 answers

Hi Gabi,

This stems from a bug in Confluence itself, where it will not produce useful anchor tags automatically for headers that contain macro markup. You'll get a similar result if you try doing something like 'h1. {color:read}A red header!{color}'.

The workaround is to generate an anchor tag for each header, and the {toc} macro will use that anchor instead. Eg:

h1. {text-data:Heading} {anchor:my heading}

This will give TOC something to work with. However, if you're in a {repeating-data} section or something like that which is dynamically generated, you obviously don't want a static anchor. The workaround here is to generate a dymamic one, most easily with the Reporting Plugin. Eg:

h1. {text-data:Heading} {report-on:injected=true}{anchor:%data:Heading%}{report-on}

This will output the heading, then output an anchor tag based on that heading.

Hope that helps!

Regards,

David Peterson

Hello,

Than's a lot for your answer but for the moment it doesn't seems to work, maybe I don't understand enough, so i'm wirtting you an example :

My wiki markup was :

{Toc}

{repeating-data:blocone|initialRows=1}

{panel:title=|borderStyle=solid|borderColor=red|borderWidth=1}

h2. {text-data:titlebloc|type=line|width=600px}Title{text-data}
{text-data:resume|type=area|width=600px|height=300px}Resume{text-data}

{panel}

{repeating-data}

{repeating-data:paragraph|initialRows=1}

h2. {text-data:prgph|type=line|width=600px}Text{text-data

{repeating-data}

I tried this markup was :

{Toc}

{repeating-data:blocone|initialRows=1}

{panel:title=|borderStyle=solid|borderColor=red|borderWidth=1}

h2. {text-data:titlebloc|type=line|width=600px}Title{text-data}
{text-data:resume|type=area|width=600px|height=300px}Resume{text-data}{report-on:injected=true}{anchor:%data:Heading%}{report-on}

{panel}

{repeating-data}

{repeating-data:paragraph|initialRows=1}

h2. {text-data:prgph|type=line|width=600px}Text{text-data}{report-on:injected=true}{anchor:%data:Heading%}{report-on}

{repeating-data}

But I still have the same problems : The "Toc" is still editable even un the view mode and the all title are twice.

Is it a bug of confluence / a macro / my wikimarkup ?

Yeah, I see what you're saying now - the text box shows up in the TOC. My guess is that TOC has changed the way it is generating itself recently and we hadn't noticed. Either that, or Confluence itself has changed the way that it sends events.

Essentially, the TOC caches the actual headings when you save it so that it doesn't have to recalculate it every time you view the page. However, for whatever reason, Scaffolding thinks it is still in 'edit' mode when getting rendered for this purpose, and as such, the edit box shows up.

This will require a bug fix, so my suggestion is to create a bug report and I'll schedule it for investigation. In the meantime, there is a workaround. You need to force TOC to refresh itself after you save the Scaffolding page. The way to do this is to add '?refresh=true' to the URL for the page when in view mode. Eg:

http://yourserver/confluence/display/SPACEKEY/My+Page?refresh=true

It only needs to be done once after saving. Not ideal, but it may work in the interim.

Regards,

David Peterson

Thank's a lot David, I created the issue :

https://greenhouse.customware.net/jira/browse/SCAFF-468

I didn't vote for it but I hope you will find time to investigate and maybe correct it.

Thank's for the tip but I'm not yhe only one user, I will keep it for me.

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 ...

764 views 23 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