page = PAGE
page {
    includeCSS {
        normalize = EXT:ds_site/Resources/Public/Css/normalize.css

        variables = EXT:ds_site/Resources/Public/Css/variables.css

        elements = EXT:ds_site/Resources/Public/Css/elements.css
        layout = EXT:ds_site/Resources/Public/Css/layout.css
        admonition = EXT:ds_site/Resources/Public/Css/admonition.css
        typo3 = EXT:ds_site/Resources/Public/Css/typo3.css
        # condition, only when necessary

        code-highlighting = EXT:ds_site/Resources/Public/Css/code-highlighting.css
    }

    meta {
        viewport = width=device-width, initial-scale=1
    }

    bodyTagCObject = COA
    bodyTagCObject {
        10 = CASE
        10 {
            key.stdWrap.cObject =< page.10.templateName.cObject
            default = TEXT
            default.value = BlogSidebar
            Full = TEXT
            Full.value = Content
            BlogPost = TEXT
            BlogPost.value = Content
        }
        stdWrap.noTrimWrap = |<body class="Layout|">|
    }

    5 = EDITPANEL
    5 {
        newRecordFromTable = tt_content
    }

    10 = FLUIDTEMPLATE
    10 {
        templateName {
            cObject = TEXT
            cObject {
                data = pagelayout
                required = 1
                case = uppercamelcase
                split {
                    token = pagets__
                    cObjNum = 1
                    1.current = 1
                }
            }
            ifEmpty = Default
        }
        layoutRootPaths {
            10 = EXT:ds_site/Resources/Private/Layouts/Page/
        }
        partialRootPaths {
            10 = EXT:ds_site/Resources/Private/Partials/
            20 = EXT:ds_site/Resources/Private/Partials/Page/
        }
        templateRootPaths {
            10 = EXT:ds_site/Resources/Private/Templates/Page/
        }

        dataProcessing {
            10 = TYPO3\CMS\Frontend\DataProcessing\DatabaseQueryProcessor
            10 {
                as = assignedTopics
                table = sys_category
                pidInList = 2
                selectFields = sys_category.*
                where = sys_category_record_mm.uid_foreign = {page:uid} AND sys_category.parent = 1
                where.insertData = 1
                leftjoin = sys_category_record_mm ON sys_category_record_mm.uid_local = sys_category.uid
                orderBy = sys_category.title ASC

                # Workaround broken workspace manipulation
                if {
                    isLessThan.data = context:workspace:id
                    value = 1
                }
            }
            11 < .10
            11 {
                as = compatibleWith
                where = sys_category_record_mm.uid_foreign = {page:uid} AND sys_category.parent = 2
                orderBy = sorting
            }
            12 = DanielSiepmann\DsSite\Frontend\DataProcessing\NaturalSortingProcessor
            12 {
                variablePath = compatibleWith
                variableSubPath = data/title
            }

            50 = TYPO3\CMS\Frontend\DataProcessing\DatabaseQueryProcessor
            50 {
                table = tt_content
                as = pageContent
                where = sectionIndex = 1 AND header_layout != 100 and colPos != 50
                orderBy = colPos, sorting
            }

            100 = DanielSiepmann\DsSite\Frontend\DataProcessing\CategoriesCounts
            100 {
                as = allTopics
                orderBy = count desc, title asc
                parent = 1
            }
            101 < .100
            101 {
                as = allTypo3Compatible
                parent = 2
            }
            102 = DanielSiepmann\DsSite\Frontend\DataProcessing\NaturalSortingProcessor
            102 {
                variablePath = allTypo3Compatible
                variableSubPath = data/title
            }

            500 = TYPO3\CMS\Frontend\DataProcessing\FilesProcessor
            500 {
                as = media
                references.fieldName = media
            }

            800 = TYPO3\CMS\Frontend\DataProcessing\MenuProcessor
            800 {
                as = rootline
                special = rootline
                # First two level are root page and folders for structure
                special.range = 2|-2

                if {
                    value = 2
                    isGreaterThan.data = level
                }
            }

            1000 = TYPO3\CMS\Frontend\DataProcessing\MenuProcessor
            1000 {
                as = mainMenu
                special = list
                special.value = 3
                levels = 2
                excludeDoktypes = 255
            }
        }

        variables {
            websiteTitle = TEXT
            websiteTitle.data = site:websiteTitle
            websiteSubTitle = TEXT
            websiteSubTitle.value = Coding is Art

            introduction =< styles.content.get
            introduction {
                select {
                    where = {#colPos}=50
                }
            }
            contentMain =< styles.content.get
            acknowledgements =< styles.content.get
            acknowledgements {
                select {
                    where = {#colPos}=100
                }
            }
            furtherReading =< styles.content.get
            furtherReading {
                select {
                    where = {#colPos}=200
                }
            }
        }
    }
}