TOC from other Page

Hello,

I would like to insert TOC from OtherPage to some CurrentPage. (The CurrentPage could contains TOC from several OtherPages). The OtherPage contains five paragraph with headings (level 1).

I’ve tried it with macros:

include macro

{{include context="NEW" reference="OtherPage.WebHome" section="HToc"/}}

  • The OtherPage has heading called Toc and the TOC macro is placed in the paragraph.
  • The include macro is place at the CurrentPage and gives only one bullet list (first heading). The other headings are ignored.

context macro

{{context document="OthePage.WebHome" transformationContext="DOCUMENT"}}
{{toc/}}
{{/context}}
  • It works better, it gives the whole content of the TOC from the OtherPage, but the links doesn’ t aim to the OtherPage. The links aims to the CurrentPage (where is the context macro placed). The user see the TOC, but it doesn’t redirect him to the OtherPage.

How can I display TOC from other page with proper links to the OtherPage?

Thanks for reporting this and congratulations: you’ve found a new rendering bug! :slight_smile:

I’ve opened Loading... to track and fix it.

Your solution with the context macro was the right one; it’s just this bug that prevents it from working.

Actually I was wrong, it’s not a bug! :slight_smile:

But we do need something more to make your use case work, see Loading...

I thought Loading... would be enough but it doesn’t work (the links are pointing to the current page, which is logical in the end but not what you want).

Thus we need to add a new feature to the TOC macro by adding a new parameter for it for this new use case.

Thank you. The new parameter in TOC macro will be very useful.

@TomasK You owe me a beer at least (figure of speech since I don’t drink beer): http://www.xwiki.org/xwiki/bin/view/ReleaseNotes/Data/XWiki/9.6RC1/#HGenerateTOCforanotherpage :slight_smile: