Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Expand
titleAdd page template definition and script to use the block:
Code Block
languageyaml
titleblock-examples/templates/pages/block.yaml
renderType: freemarker
title: Block Page
templateScript: block-examples/templates/pages/block.ftl
Code Block
languageyaml
titleblock-examples/templates/pages/block.ftl
[#assign testContent = cmsfn.contentByPath("/test", "stories") /]
[#assign blocks = cmsfn.children(testContent, "mgnl:block") /]

<!DOCTYPE html>
<html xml:lang="en" lang="en" class="no-js">
    <head>
        [@cms.page /]
    </head>
    <body>
        ${content.title!""}
        ${content.lead!""}
        [#if testContent?hasContent]
        [#assign blocks = cmsfn.children(testContent, "mgnl:block") /]
        [#list blocks as block]
            [@cms.block content=block /]
        [/#list]
        [/#if]
    </body>
</html>
Expand
titleAdd a page using the new block type:

Image Added

Click Next and then preview the page you just added.  The quote you entered earlier should be displayed.

Expand
titleResulting directory structure:
Code Block
languagebash
block-examples/
├── blocks
│   └── quote.yaml
├── decorations
│   └── stories-app
│       └── apps
│           └── stories.yaml
├── i18n
│   ├── example-blocks_de.properties
│   └── example-blocks_en.properties
└── templates
    ├── blocks
    │   ├── quote.ftl
    │   └── quote.yaml
    └── pages
        ├── block.ftl
        └── block.yaml

...