You need to enable JavaScript to run this app.
最新活动
大模型
产品
解决方案
定价
生态与合作
支持与服务
开发者
了解我们

Magnolia CMS页面模板编辑时编辑器空白问题:如何使页面对话框正常显示?

Fixing Blank Page Editor in Magnolia CMS for Custom Page Templates

Let’s walk through the most common fixes for the blank page editor issue you’re facing—since you’ve already confirmed the [@cms.page /] tag is present in your template, the problem likely lies in configuration paths or placeholder values:

1. Replace the module-name placeholder with your actual module name

This is the most probable root cause. The mgnl create-page command uses module-name as a generic placeholder, but you need to swap it with your real module's name everywhere:

  • Update your hello.yaml template definition:
    title: hello
    templateScript: /your-real-module-name/templates/pages/hello.ftl
    renderType: freemarker
    dialog: your-real-module-name:pages/hello
    visible: true
    
  • In hello.ftl, replace all instances of module-name with your module name (especially if you plan to use the commented-out resource/theme lines later):
    <!-- Example if you uncomment the resource links -->
    <link rel="stylesheet" type="text/css" href="${ctx.contextPath}/.resources/your-real-module-name/webresources/css/bootstrap.css" media="all" />
    

2. Verify the template is registered in your module's config

Check if your hello template is listed in your module's templates/pages.yaml file. If it’s missing, add this entry to ensure Magnolia recognizes the template:

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

3. Double-check dialog path validity

Even though the page creation form works, confirm the dialog reference is correctly mapped:

  • Ensure dialogs/pages/hello.yaml exists in your module directory with valid field definitions.
  • The dialog reference format module-name:pages/hello points to /module-name/dialogs/pages/hello.yaml—make sure your module name here matches exactly.

4. Check Magnolia logs for specific errors

If the above steps don’t fix the issue, look into the magnolia.log file (usually in your Magnolia instance’s logs folder) for clues. Common errors to watch for:

  • TemplateNotFoundException: Magnolia can’t locate your hello.ftl file (path mismatch)
  • DialogNotFoundException: The dialog path in your template definition is invalid
  • Freemarker syntax errors: Typos or invalid logic in your .ftl file

5. Add editable areas (optional)

While this won’t resolve a blank editor, if you want users to edit page content directly, add a CMS area to your hello.ftl:

<div class="container">
  <h1>hello works!</h1>
  [@cms.area name="mainContent" /]
</div>

Then update your hello.yaml template definition to include the area configuration.

内容的提问来源于stack exchange,提问作者George

火山引擎 最新活动