Include default nodes in a template


(Jan Wessel) #1

Hi everyone,

I’ve successfully included some nodes in my template and hope this will reduce the time an editor needs to create new pages. But the content collections containing those nodes don’t appear in the backend.

And I would rather have the editor fill in the content of the nodes not in the page properties but in the nodes themselves.

My code looks like the following:

This is the Fusion-Code of the template in question:

prototype(Company.Project:Page.TeamPage) < prototype(Company.Project:Page) {

    body {
        templatePath = 'resource://Company.Project/Private/Templates/Page/TeamPage.html'

        pageTheme = ${q(node).property('pageTheme')}

        content {

            hero = Neos.Neos:PrimaryContent {
                nodePath = 'hero'

                default {
                    condition = TRUE
                    renderer = Company.Project:ImageSection {
                        heading = ${q(node).property('heading')}
                        subheading = 'team'
                        image >
                        imageMobile >
                    }
                }
            }

            intro = Neos.Neos:PrimaryContent {
                nodePath = 'intro'

                default {
                    condition = TRUE
                    renderer = Company.Project:IntroSection {
                        intro = ${q(node).property('intro')}
                    }
                }
            }

This is a code excerpt of my Root.fusion:

		content {
			hero >

			intro >

			// The default content section
			main = Neos.Neos:PrimaryContent {
				nodePath = 'main'
			}

			footer = Neos.Fusion:Case {

I’ve got Fluid templates defined for both Company.Project:ImageSection and Company.Project:IntroSection.

In the backend, if I create a new page of the specific type, I see only the Collections main and footer.

What am I doing wrong or am I missing sth. important?

Thanks in advance,
Jan


(Daniel Lienert) #2

Hey Jan,

there is a lot of context missing to be able to find the problem.

  • Have you defined these new ContentCollections in you pages NodeType configuration?`
  • Have you outputtet these new content in you Fluid file?

(Jan Wessel) #3

Hi Daniel,

thanks for your feedback!

I followed your suggestion to add the required collections in the configuration and indeed now the show up! What’s left is configuring the nodes themselves so that they already appear in the collections.

Update: I stopped the development on that topic.

https://github.com/Flowpack/Flowpack.NodeTemplates looked promising, but I don’t have the time to try it out.

Regards, Jan