This question about Using an extension: Asked

TOC integration with Natskin SiteSideBar

Hello,

I am trying to add a table of contents to the SiteSideBar (I have defined my own as SiteSideBar).

I can see that the file is used, but if I use I am not getting anything. I assume that could be due to how the system generates the web page: Is there a way to make it work?

My goal is to have the TOC above the sidebars that come by default with Natskin.

Thank you!

-- GeraudK - 31 Aug 2021

If the TOC macro is not in the same topic as the one containing the content being listed, you need to add the topic and web parameters to the macro. So something like this:
%TOC{"%BASETOPIC%" web="%BASEWEB%" title="On this page:"}%

. See System.VarTOC for more info.

-- LynnwoodBrown - 01 Sep 2021

I tried running with
%TOC{"%BASETOPIC%" web="%BASEWEB%" title="On this page:"}%
, but I am finding something strange: nothing appears.

However if I statically set a TOC from a Web and topic, it appears everywhere... except on the page of interest!

eg: If i have a Web called MyWeb, with two topics MyTopic1 and MyTopic2, if I use:
%TOC{"MyWeb" web="MyTopic1"}%

then the TOC is displayed on MyTopic2, but not on MyTopic1!

-- GeraudK - 13 Sep 2021

I've confirmed what you're observing. You appear to have stumbled into a bug related to how VarTOC is expanding in the sidebar, also possibly related to WEBCOMPONENT macro (part of NatSkinPlugin). I'm trying to come up with a work-around for short term.

-- LynnwoodBrown - 14 Sep 2021

Try this:
  • Put the TOC into a separate named section as per below. It can even be in your same SiteSideBar topic, as long as there is a VarSTOPINCLUDE macro before your new named section.
    %STARTSECTION{"toc"}%
    %TOC{"%BASETOPIC%" web="%BASEWEB%" title="On this page:"}%
    %ENDSECTION{"toc"}%
  • Add a DBCALL macro in the main part of your SiteSideBar, pointing to your new named section:
    %DBCALL{"%WEB%.%TOPIC%" section="toc"}%

Note: Even though DBCALL (from DBCachePlugin) is nearly identical to VarINCLUDE in most instances, it works in this case whereas VarINCLUDE will not. The crux of the problem we're running into here (I think) is that TOC is rendering too early to get the correct BASETOPIC. By time DBCALL renders, we can count on this being correct. Hope this makes some sense.

Let us know how it goes.

-- LynnwoodBrown - 14 Sep 2021
 

QuestionForm edit

Subject Using an extension
Extension NatSkin
Version Foswiki 2.1.6
Status Asked
Related Topics
Topic revision: r5 - 14 Sep 2021, LynnwoodBrown
The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. See Copyright Statement. Creative Commons License    Legal Imprint    Privacy Policy