I did some brute force bug tracking and manage to track down the problem.
I made two different files:
test1.org:
#+TITLE: Test 1
#+OPTIONS: toc:nil
#+INFOJS_OPT:
* Header 1
* Header 2
** Subheader 2.1
test2.org:
#+TITLE: Test 1
#+OPTIONS: toc:nil
* Header 1
* Header 2
** Subheader 2.1
In the first example i have the header with #+INFOJS_OPT:
empty, the other file lacks this line. The first file generates a toc while the other doesn't.
I manage to track down the variable org-html-infojs-opts-table
which has the
Value: ((path PATH "
http://orgmode.org/org-info.js")
(view VIEW "info")
(toc TOC :with-toc)
(ftoc FIXED_TOC "0")
(tdepth TOC_DEPTH "max")
(sdepth SECTION_DEPTH "max")
(mouse MOUSE_HINT "underline")
(buttons VIEW_BUTTONS "0")
(ltoc LOCAL_TOC "1")
(up LINK_UP :html-link-up)
(home LINK_HOME :html-link-home))
It seems to me as a novice that the :with-toc is defined here and forces a table of contents to be displayed. Not sure if this is correct but at least it solved my problem.