[SOLVED] Fehler: "No content collection of type ... could be found

Hallo Zusammen,

ich habe für mich ein NodeType ("Geosphere.Apex:Carousel"), wie in den verschiedenen Tutorials gezeigt wird, mit der Funktion eines Carousels umgesetzt. Dieses Funktioniert auch wenn ich es zum Beispiel im “normalen” “Content.Collection(main)” einbinde. Da wird mir das Carousel richtig dargestellt.
Jetzt möchte ich aber dieses “Geosphere.Apex:Carousel” als Teaserelement als einziges Content anbieten. Analog einer “Sidebar”.
Leider wird da mir das Carousel nicht angezeigt. Anscheinend stimmt was mit dem Pfad zum "carluselItems" nicht??
Wenn ich im “PAGE.YAML” für den myTag1: den Typen 'Neos.Neos.ContentCollection' eintrage, dann funktioniert es wieder.

    main:
      type: 'Neos.Neos:ContentCollection'

Aber ich möchte hier keine anderen Contents eintragen lassen. Es soll mir nur beim Erzeugen der Seite gleich an meiner gewünschten Stelle ein Carousel angeboten werden.

Vielleicht kann mir hier einer weiter helfen…

viele Grüße
Werner

No content collection of type Neos.Neos:ContentCollection could be found in the current node (/sites/geosphere-apex) or at the path "carouselItems". You might want to adjust your node type configuration and create the missing child node through the "flow node:repair --node-type Geosphere.Apex:Page" command.

Template HTML
{content.test -> f:format.raw()}

Page.yaml

'Geosphere.Apex:Page':
      superTypes:
        'Neos.Neos:Document': true
      ui:
        icon: 'icon-file'
        label: 'Geosphere.Apex Custom Page'
      childNodes:
        main:
          type: 'Neos.Neos:ContentCollection'
        myTag1:
          type: 'Geosphere.Apex:Carousel'

NodeTypes.Carousel.yaml

prototype(Geosphere.Apex:Carousel) {
    carouselItems = Neos.Neos:ContentCollection {
      nodePath = ‘carouselItems’
      content.iterationName = ‘carouselItemsIteration’
      attributes.class = ‘carousel-inner’
      attributes.class.@process.collectionClass >
    }
    carouselItemArray = ${q(node).children(‘carouselItems’).children(’[instanceof Geosphere.Apex:CarouselItem]’)}
    }

Page.fusion

prototype(Geosphere.Apex:Page) < prototype(Geosphere.Apex:DefaultPage) {
        body {
           // These are your content areas, you can define as many as you want, just name them and define the nodePath.
           content {
              // The default content collection
              main = Neos.Neos:PrimaryContent {
                  nodePath = 'main'
              }
              test = Geosphere.Apex:Carousel {
                  nodePath = 'myTag1'
              }
           }
         }
}

An dieser Stelle ist anders wie das Carousel von Fusion aufgerufen wird. Beim Content rendering wird zusätzlich noch die node auf das passende Element gesetzt, da Du hier selbst renderst musst du auch das selber machen. D.h. während des renders der page ist node === documentNode . Die ContentCollection macht das folgende auch schon intern über nodePath (weil sie in der Regel auf pages benutzt wird), aber das geht nicht automatisch bei jedem prototype…

prototype(Geosphere.Apex:Page) < prototype(Geosphere.Apex:DefaultPage) {
    body {
       // These are your content areas, you can define as many as you want, just name them and define the nodePath.
       content {
          // The default content collection
          main = Neos.Neos:PrimaryContent {
              nodePath = 'main'
          }
          test = Geosphere.Apex:Carousel {
              @context.node = ${q(documentNode).children('myTag1').get(0)}
          }
       }
     }
}

Danke für die Lösung und die gute Erklärung! :+1:
Durch die Erklärung habe ich jetzt auch das eigentliche Problem verstanden.

1 Like