Ease and improve TOC generation

Do not add another level of data processing.
Allow to hide content in TOC.
Ensure ordering of elements in TOC reflects ordering in rendering.
This commit is contained in:
Daniel Siepmann 2020-08-20 11:50:35 +02:00
parent 2bcf14f5b1
commit c60a207394
4 changed files with 14 additions and 28 deletions

View file

@ -34,9 +34,6 @@ TCEFORM.tt_content {
space_after_class { space_after_class {
disabled = 1 disabled = 1
} }
sectionIndex {
disabled = 1
}
linkToTop { linkToTop {
disabled = 1 disabled = 1
} }

View file

@ -73,21 +73,12 @@ page {
orderBy = sorting orderBy = sorting
} }
50 = TYPO3\CMS\Frontend\DataProcessing\MenuProcessor 50 = TYPO3\CMS\Frontend\DataProcessing\DatabaseQueryProcessor
50 { 50 {
as = pageSections table = tt_content
special = list as = pageContent
special.value.data = page:uid where = sectionIndex = 1 AND header_layout != 100 and colPos != 50
dataProcessing { orderBy = colPos, sorting
10 = TYPO3\CMS\Frontend\DataProcessing\DatabaseQueryProcessor
10 {
table = tt_content
pidInList.field = uid
as = content
where = sectionIndex = 1 AND header_layout != 100
orderBy = sorting
}
}
} }
100 < .10 100 < .10

View file

@ -51,15 +51,13 @@
<li> <li>
<a href="#introduction">Introduction</a> <a href="#introduction">Introduction</a>
</li> </li>
<f:alias map="{contentSections: pageSections.0.content}"> <f:for each="{pageContent}" as="contentEntry">
<f:for each="{contentSections}" as="contentEntry"> <f:if condition="{contentEntry.data.header}">
<f:if condition="{contentEntry.data.header}"> <li>
<li> <a href="#c{contentEntry.data.uid}">{contentEntry.data.header}</a>
<a href="#c{contentEntry.data.uid}">{contentEntry.data.header}</a> </li>
</li> </f:if>
</f:if> </f:for>
</f:for>
</f:alias>
<f:if condition="{acknowledgements}"> <f:if condition="{acknowledgements}">
<li> <li>
<a href="#acknowledgements">Acknowledgements</a> <a href="#acknowledgements">Acknowledgements</a>

View file

@ -18,7 +18,7 @@
})} })}
{f:render(section: 'TableOfContent', arguments: { {f:render(section: 'TableOfContent', arguments: {
contentSections: pageSections.0.content pageContent: pageContent
})} })}
</f:section> </f:section>
@ -42,7 +42,7 @@
<nav> <nav>
<h1>Table of Content</h1> <h1>Table of Content</h1>
<ol> <ol>
<f:for each="{contentSections}" as="contentEntry"> <f:for each="{pageContent}" as="contentEntry">
<f:if condition="{contentEntry.data.header}"> <f:if condition="{contentEntry.data.header}">
<li> <li>
<a href="#c{contentEntry.data.uid}">{contentEntry.data.header}</a> <a href="#c{contentEntry.data.uid}">{contentEntry.data.header}</a>