
\setuphead[chapter][page=no]

\setupheadertexts[text][chapter][pagenumber]
\setupheader[text][state=start]

\setupinteraction[state=start,style=,color=]

% by Taco Hoekwater, 2015-09-30
\newif\iffirstFIDXpage
\def\textcommand#1{#1\global\firstFIDXpagetrue}
\def\pagecommand#1{\iffirstFIDXpage (p.~\fi \global\firstFIDXpagefalse #1} % this adds (p. before the page numbers
\def\stopregisterpages{)\dostoptagged\endgroup} % this adds the brace after the page numbers
% end Taco

\defineregister[fidx]
\setupregister[fidx][%
	n=1,
	%align=yes, balance=no,
	compress=yes,
	indicator=no,
	textcommand=\textcommand,
	pagecommand=\pagecommand,
	distance=0.5em,
	before={},
	after={},
]

\setupheadtext[fidx=Figures]

\setupnote[footnote][%
	way=bypage,% DOES NOTHING
	numberconversion=set 2]

\definehead[Kapitel][chapter]
\definehead[Abschnitt][section]


\starttext

%\writetoregister[fidx][Picasso]{Cover} % BUG: command undefined!?

\dorecurse{20}{%
\expanded{\Kapitel{My chapter \recurselevel}}\fidx{Picasso}
\expanded{%
\placefigure[top][abb]{Caption \recurselevel}{{\externalfigure[koe][width=\textwidth]}}
\fidx{Fig.\recurselevel}
}
\expanded{\index{Index entry \recurselevel}}
\expanded{\section{My Zapf \recurselevel}}
\input zapf\expanded{\footnote{Zapf \recurselevel}}
\placefigure[left][abb]{Caption 0.\recurselevel}{{\externalfigure[koe][width=0.33\textwidth]}}
\fidx[spinoza]{Baruch Spinoza}
\expanded{\section{My Tufte \recurselevel}}
\input tufte\expanded{\footnote{Tufte \recurselevel}}
}

\completeindex % OK

\completecontent[criterium=all] % OK

\completefidx

\stoptext