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 {
disabled = 1
}
sectionIndex {
disabled = 1
}
linkToTop {
disabled = 1
}

View file

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

View file

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

View file

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