【问题标题】:Neos CMS error when placing content to page将内容放置到页面时出现 Neos CMS 错误
【发布时间】:2022-01-19 18:30:43
【问题描述】:

最近在 Neos CMS 中,当我在页面中使用内容元素时出现此错误。

An exception was thrown while Neos tried to render your page
The Fusion object `Company.Corp:Content.ContactUsPage` cannot be rendered: Most likely you 
mistyped the prototype name or did not define the Fusion prototype with 
`prototype(Company.Corp:Content.ContactUsPage) < prototype ...` . Other possible reasons are a 
missing parent-prototype or a missing `@class` annotation for prototypes without parent. It is 
also possible your Fusion file is not read because of a missing `include:` statement.

但我认为我的 Node 和 Fusion 文件是正确的,没有任何错误。但也许我错了。你能帮我解决这个错误吗?我是这方面的初学者。

这是我的 Node 文件中的代码 NodeTypes.Content.ContactUsPage.yaml

'Company.Corp:Content.ContactUsPage':
 superTypes:
    'Neos.Neos:Content': true

 ui:
     label: 'Contact Us Page'
     icon: icon-file-text
     inlineEditable: true
     inspector:
       groups:
         showCases:
           label: 'Contact Us Page Data'
           icon: icon-file-text
           position: 5

 properties:
   smallTitle:
     type: string
     defaultValue: ''
     ui:
       label: 'Small Title'
       inspector:
          group: 'contactUsPage'
          editorOptions:
            placeholder: ''
            maxlength: 300

这是我的融合文件 ContactUsPage.fusion

prototype(Company.Corp:Content.ContactUsPage) < prototype(Neos.Neos:ContentComponent) {
smallTitle = Neos.Neos:Editable {
    property = 'smallTitle'
}


renderer = afx`
    <div id="contact" class="row mt-5">
        <div class="col-lg-6">
            <div class="contact-caption">
                <div class="section-title mt-5">
                    <div class="upTitle">{props.smallTitle}</div>
                </div>
            </div>
        </div>
    </div>        
  `
}

【问题讨论】:

    标签: fusion neoscms


    【解决方案1】:

    将您的 Fusion 文件重命名为“Content.ContactUsPage.fusion”,这样就可以了。

    或者,您可以将 .yaml 中的 line1 重写为: Company.Corp:ContactUsPage':

    两者都应该工作 fusion 文件的命名需要等同于你的 yaml 中的第一行。如果您选择“Content.foo”,您的 Fusion 也需要命名为“Content.Foo.fusion”。

    希望对你有帮助

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-01-14
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-02-08
      • 2011-04-23
      • 2019-08-01
      • 1970-01-01
      相关资源
      最近更新 更多