How to add custom sections to <body>?

My standard Page node, page uses predefined sections:

page = Page {
  head {
    metadata = TYPO3.TypoScript:Template {
      templatePath = 'resource://TH.Blog/Private/Templates/Page/Default.html'
      sectionName = 'metadata'
    }
  }

  body {
    templatePath = 'resource://My.Page/Private/Templates/Page/Default.html'
    sectionName = 'body'
  }
}

If another Page node derives from that I wouldn’t have to define these sections. If I’m fine with how metadata is defined in page I can reuse it in that deriving node. I just need to adjust the templatePath of the body section:

custom < page {

  body.templatePath = 'resource://My.Page/Private/Templates/Page/Custom.html'

}

I’d like to use that functionality with custom sections within body. I tried:

page = Page {
  head { … }

  body {
    templatePath = 'resource://My.Page/Private/Templates/Page/Default.html'
    sectionName = 'body'

    footer = TYPO3.TypoScript:Template {
      templatePath = 'resource://My.Page/Private/Templates/Page/Default.html'
      sectionName = 'footer'
    }
  }
}

But this doesn’t work.

#Default.html
<!DOCTYPE html>
{namespace neos=TYPO3\Neos\ViewHelpers}
{namespace ts=TYPO3\TypoScript\ViewHelpers}
<html>
  <head>
    …
  </head>
  
  <body>
    <f:section name="body">
      <p>Body</p>
      <f:section name="footer">
        <footer><p>Footer</p></footer>
      </f:section>
    </f:section>
  </body>

</html>

This Fluid template “looses” the footer section. Why?

<!DOCTYPE html>
<html>
  <head>
    …
  </head>
  
  <body>
      <p>Body</p>
  </body>

</html>

Hey @kurztipp,

didn’t tested this but i think this can not work the way you did it.
First of all your footer is a typoscript path within your body. So if you look at the rendering stack your body get rendered first. So everything in your section body get’s rendered. Fluid looks up a section with name body. But fluid won’t render a section in a section by default. To be honest i don’t know if you can even best sections by default. So your p tag will be returned.
Now you do want to render your typoscript footer path. So something like {footer -> f:format.raw()} or <ts:render path="footer"/>should do the trick. That will render the ts path footer. And then fluid will search for a section called footer within the Default.html and return the rendered template.

So you should first of all try to render the footer path. If that still does not work try to but your footer section outside the body section.