Summary

      If I add a TOC macro to the sidebar the links do not work

      Steps to Reproduce

      1. Install Confluence 5.9.12 or Confluence 5.10.1
      2. Create a page with some headings
      3. Go to Space Tools>Look and Feel>sidebar, header and footer
      4. Paste this into the sidebar field:
        {toc:maxLevel=2|style=disc|indent=10px|absoluteURL=false}

        or even simply

        {toc}

      Expected Results

      The links from the TOC would lead to the headings on the page

      Actual Results

      An invalid URL is created by the links in the sidebar. Please see attached screenshots showing the TOC URLs created by:

      • clicking on a TOC macro link in a page


        compared to
      • clicking on a TOC macro link in the sidebar

      Workaround

      Adding absoluteUrl=true to the wiki markup for the sidebar helps for some instances.

        1. TOCsidebarURL5.10.1.png
          TOCsidebarURL5.10.1.png
          227 kB
        2. TOCsidebarURL5.9.12.png
          TOCsidebarURL5.9.12.png
          255 kB
        3. TOCpageURL5.10.1.png
          TOCpageURL5.10.1.png
          125 kB
        4. TOCpageURL5.9.12.png
          TOCpageURL5.9.12.png
          463 kB

            [CONFSERVER-43090] TOC macro in sidebar creates invalid URL

            "Zero-config TOC as retractable sidebar" is a significant feature to navigate long policy documents. Slab has it OOTB:

             

            arboliveira added a comment - "Zero-config TOC as retractable sidebar" is a significant feature to navigate long policy documents. Slab has it OOTB:  

            jtcorwi added a comment -

            This still doesn't work in 6.13.8 Enterprise and I don't have admin permissions and our admins are persnickety (since we have a very large enterprise instance) and they hate to do anything "special." And if it doesn't function perfectly (see the indent problem) they won't even think about deploying it. I don't even have a platform where I can try the fix.

            The current Confluence Users <anual indicates this should work, but in addition to not fixing bugs, Atlassian doesn't bother to fix documentation.

            jtcorwi added a comment - This still doesn't work in 6.13.8 Enterprise and I don't have admin permissions and our admins are persnickety (since we have a very large enterprise instance) and they hate to do anything "special." And if it doesn't function perfectly (see the indent problem) they won't even think about deploying it. I don't even have a platform where I can try the fix. The current Confluence Users <anual indicates this should work, but in addition to not fixing bugs, Atlassian doesn't bother to fix documentation.

            Jari Rayo added a comment -

            Sebastian, that does indeed fix the links. Thank you for that! However, it also seems to break indentation for the ToC regardless of whether you specify it yourself or just go with the default. Does the same happen for you or anyone else here as well?

            Jari Rayo added a comment - Sebastian, that does indeed fix the links. Thank you for that! However, it also seems to break indentation for the ToC regardless of whether you specify it yourself or just go with the default. Does the same happen for you or anyone else here as well?

            Hi, I have set up a small workaround to fix the problem.

            First, I added a class in the macro:

            {toc:maxLevel=2|class=skowio-sidebar-contents}
            

            Then I built some javascript logic, which replaced the path to a fragment and removed the query. In other words, before each link a # was placed:

            <script type="text/javascript">
            AJS.$(window).load(function() {
                AJS.$('.skowio-sidebar-contents').find('a').each(function() {
                    AJS.$(this).attr(
                        'href',
                        '#' + $(this).attr('href').replace(/(\?|&)src=sidebar/g, '')
                    );
                })
            });
            </script>
            

            Just past it in the textarea under Admin Settings -> Custom HTML -> At end of the HEAD

            Sebastian Koch added a comment - Hi, I have set up a small workaround to fix the problem. First, I added a class in the macro: {toc:maxLevel=2|class=skowio-sidebar-contents} Then I built some javascript logic, which replaced the path to a fragment and removed the query. In other words, before each link a # was placed: <script type= "text/javascript" > AJS.$(window).load(function() { AJS.$( '.skowio-sidebar-contents' ).find( 'a' ).each(function() { AJS.$( this ).attr( 'href' , '#' + $( this ).attr( 'href' ).replace(/(\?|&)src=sidebar/g, '') ); }) }); </script> Just past it in the textarea under Admin Settings -> Custom HTML -> At end of the HEAD

            Can you solve this please?

            Julia Suarez added a comment - Can you solve this please?

            Why is broken functionality from an upgrade listed at a low priority? 

            David Stemm added a comment - Why is broken functionality from an upgrade listed at a low priority? 

            Nate M added a comment -

            We just upgraded to 6.3.4 and now the TOC in the sidebar no longer works... the links are broken.  Can you fix this please?!

            Nate M added a comment - We just upgraded to 6.3.4 and now the TOC in the sidebar no longer works... the links are broken.  Can you fix this please?!

            We have this bug on 5.9.4 and 6.5.1 versions

            Daniil Lyovkin added a comment - We have this bug on 5.9.4 and 6.5.1 versions

            We are facing the same issue in 6.0.3.

            Would like to understand when this issue is going to get fixed?

            Qualcomm Support added a comment - We are facing the same issue in 6.0.3. Would like to understand when this issue is going to get fixed?

            Doesn't work with Confluence 6.2.0 either...

            Any idea when it might be corrected ? What shall happen to change the priority from low to... higher ?

            Administrateur SI added a comment - Doesn't work with Confluence 6.2.0 either... Any idea when it might be corrected ? What shall happen to change the priority from low to... higher ?

              Unassigned Unassigned
              aworley Ann Worley (Inactive)
              Affected customers:
              32 This affects my team
              Watchers:
              29 Start watching this issue

                Created:
                Updated: