Tags:
create new tag
view all tags

SID-01748: Table of Contents on every topic view

Status: Answered Answered TWiki version: 5.1.1 Perl version: 5.10.0
Category: CategoryTemplates Server OS: SUSE Linux Enterprise Server 11, kernel 3.0.73 Last update: 12 years ago

I am new to TWiki and have recently successfully migrated my existing corporate IT wiki from MediaWiki to TWiki as part of a continuous improvement initiative. MediaWiki has the feature of automatically generating a table of contents for each page. In TWiki I can generate a table of contents for a topic by explicitly adding %TOC% to the topic content.

Is there a way I can have a Table of Contents automatically generated for each topic when viewed without editing the topic to add %TOC%?

I have a custom view template which incorporates the BreadCrumbsPlugin and RedirectPlugin. However, adding %TOC% to it does not seem to work. Another possibility that I haven't tried it is to create a custom edit template for new topics which adds the %TOC%.

I have searched for an answer to this but could not find one.

Any advice would be much appreciated.

-- Andrew Benedek - 2013-06-26

Discussion and Answer

In your custom view template, have you tried this?

%TOC{ "%BASETOPIC%" web="%BASEWEB%" depth="3" }%

See details in VarTOC2.

-- Peter Thoeny - 2013-06-26

Thanks Peter, I tried your suggestion but it didn't work either. My SKIN setting is myskin, tagme, topmenu, pattern.

Below is part of my custom view template:

%TMPL:DEF{"mytoc"}%%TOC{ "%BASETOPIC%" web="%BASEWEB%" depth="3" }%%TMPL:END%

%TMPL:DEF{"contentheader"}%

<div class="tagmetags"> Tags: %TAGME{ tpaction="%URLPARAM{tpaction}%" web="%WEB%" tag="%URLPARAM{tag}%" }%, view all tags, search for tags </div>

<div class="patternTop">%TMPL:P{"breadcrumb"}%</div>

<div class="patternTop">%BREADCRUMBS{type="path" separator=" » "}%</div>

<div class="patternTop">%TMPL:P{"redirectedfrom"}%</div>

<div class="patternTop">%TMPL:P{"mytoc"}%</div>

I am here 1

%TMPL:END%

-- Andrew Benedek - 2013-06-27

I checked - there was a bug/optimization that prevented the TOC from working properly if present in a skin. This is now fixed, you need to apply the patch listed at TWikibug:Item7286.

-- Peter Thoeny - 2013-06-27

Thanks Peter, much appreciated. Patching using the patch tool failed for me on hunk 4 probably because I did not have the patch for Item6864, but managed to merge it manually. Thanks again.

-- Andrew Benedek - 2013-06-28

I am glad it worked out for you.

-- Peter Thoeny - 2013-06-28

      Change status to:
ALERT! If you answer a question - or someone answered one of your questions - please remember to edit the page and set the status to answered. The status selector is below the edit box.
SupportForm
Status Answered
Title Table of Contents on every topic view
SupportCategory CategoryTemplates
TWiki version 5.1.1
Server OS SUSE Linux Enterprise Server 11, kernel 3.0.73
Web server Apache 2.2.12
Perl version 5.10.0
Browser & version Chrome 20.0.1132.57 m
Edit | Attach | Watch | Print version | History: r6 < r5 < r4 < r3 < r2 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r6 - 2013-06-28 - PeterThoeny
 
  • Learn about TWiki  
  • Download TWiki
This site is powered by the TWiki collaboration platform Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2026 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.