Not logged in. · Lost password · Register
Forum: General Help and Support Templates and Layout RSS
TOC : Collapse automaticaly ?
Avatar
Jacques-Olivier #1
Member since Jun 2018 · 5 posts
Group memberships: Members
Show profile · Link to this post
Subject: TOC : Collapse automaticaly ?
Hello dear wiki users,

I use a TOC in my wiki, and this TOC is expand by default when i go to a wiki page.
Is there a way to have TOC collapase by default ?

I didn't find this option.

Have a nice day,
Avatar
LarsDW223 #2
Member since Sep 2014 · 344 posts · Location: Paderborn
Group memberships: Members
Show profile · Link to this post
Hello Jacques-Olivier,

to answer/help with the question we need to know which template you are using.

Greetings,
Lars
Avatar
schplurtz (Moderator) #3
Member since Nov 2009 · 310 posts · Location: France, Finistère
Group memberships: Global Moderators, Members
Show profile · Link to this post
Hey, It seems this is time I updated this very old code !

With DokuWiki greebo, and the default template, if you only want a few pages with the toc collapsed, you can use this trick :

Create an entity named ~~closetoc~~ by editing (or creating) configuration file conf/entities.local.conf. The line that need to be added is this one :
~~closetoc~~ <script>jQuery(function(){jQuery("\x23dw__toc").children().first().click();});</script>

Then, somewhere in your page source, add ~~closetoc~~ on a line by itself.
When the page is loaded, the toc will collapse.

Drawbacks:
  * The toc is initially expanded and when the page is loaded, it collapses. The visual effect may be disturbing.
  * the all the code is probably visible in rendered document if you use doku2pdf or doku2odt converters.

I you want to apply this to all the pages in your wiki, you can instead add the javascript code in file lib/tpl/dokuwiki/footer.html. not tested but should work.

Schplurtz
http://schplurtz.free.fr/wiki/
Avatar
Michaelsy #4
Member since Jun 2015 · 567 posts · Location: Düsseldorf, Germany
Group memberships: Members
Show profile · Link to this post
the all the code is probably visible in rendered document if you use doku2pdf or doku2odt converters.

I assume you can avoid this by adding the following rule into the style.css of the dw2pdf plugin (for ODT Plugin there is maybe a similar CSS file) :

  1. style { display: none; }

Not tested!

HTH - Michael Sy.
By Patreon.com a few eurons can be fed into the code phasers of
the DokuWiki engine. Besides, Andi's posts are worth reading.
Close Smaller – Larger + Reply to this post:
Verification code: VeriCode Please enter the word from the image into the text field below. (Type the letters only, lower case is okay.)
Smileys: :-) ;-) :-D :-p :blush: :cool: :rolleyes: :huh: :-/ <_< :-( :'( :#: :scared: 8-( :nuts: :-O
Special characters:
Go to forum
Imprint
This board is powered by the Unclassified NewsBoard software, 20150713-dev, © 2003-2015 by Yves Goergen
Current time: 2018-12-14, 05:19:04 (UTC +01:00)