【问题标题】:Magnolia CMS Page dialog emptyMagnolia CMS 页面对话框为空
【发布时间】:2021-11-19 11:19:20
【问题描述】:

我用mgnl create-page hello 创建了一个页面模板。命令运行成功,并创建了必要的文件:

  1. 模板/页面/hello.yaml
  2. dialogs/pages/hello.yaml
  3. 模板/页面/hello.ftl

When I create a page, a form appears with seemingly the correct fields.

But when I try to edit the page, the page editor box is empty.

即使 .ftl 文件在 head 元素中包含 [@cms.page /]

hello.ftl的文件内容:

<!DOCTYPE html>
<html xml:lang="${cmsfn.language()}" lang="${cmsfn.language()}">
  <head>
    [@cms.page /]
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <title>${content.windowTitle!content.title!}</title>
    <meta name="description" content="${content.description!""}" />
    <meta name="keywords" content="${content.keywords!""}" />

    [#-- To load resources you can link them manually (e.g. line below) --]
      [#-- <link rel="stylesheet" type="text/css" href="${ctx.contextPath}/.resources/module-name/webresources/css/bootstrap.css" media="all" /> --]
      [#-- <script src="${ctx.contextPath}/.resources/module-name/webresources/js/jquery.js"></script> --]
    [#-- or via theme --]
      [#-- [#assign site = sitefn.site()!] --]
      [#-- [#assign theme = sitefn.theme(site)!] --]
      [#-- [#list theme.cssFiles as cssFile] --]
      [#--   [#if cssFile.conditionalComment?has_content]<!--[if ${cssFile.conditionalComment}]>[/#if] --]
      [#--     <link rel="stylesheet" type="text/css" href="${cssFile.link}" media="${cssFile.media}" /> --]
      [#--   [#if cssFile.conditionalComment?has_content]<![endif]-->[/#if] --]
      [#-- [/#list] --]
      [#-- [#list theme.jsFiles as jsFile] --]
      [#--   <script src="${jsFile.link}"></script> --]
      [#-- [/#list] --]
    [#-- uncomment next line to use resfn templating functions to load all css which matches a globbing pattern --]
      [#-- ${resfn.css(["/module-name/.*css"])!} --]
  </head>
  <body class="hello ${cmsfn.language()}">

    <div class="container">
      <h1>hello works!</h1>
    </div>

    [#-- use resfn to load all js which matches the globbing pattern or link resources manually or via theme --]
    [#-- ${resfn.js(["/module-name/.*js"])!} --]
  </body>
</html>

hello.yaml的文件内容:

title: hello
templateScript: /module-name/templates/pages/hello.ftl
renderType: freemarker
dialog: module-name:pages/hello
visible: true

我如何才能看到“页面”对话框“可见”?

【问题讨论】:

    标签: magnolia


    【解决方案1】:

    试试这个:

    mgnl create-component test --available hello@main
    

    然后编辑

    templates/pages/hello.ftl
    

    移动最后一行

    [@cms.area name="main"/]
    

    &lt;/body&gt; 标记的正上方。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多