Skip to content

Instantly share code, notes, and snippets.

@christophengelmayer
Last active March 11, 2020 10:48
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save christophengelmayer/7aa94a7582ef6934dea9ca49d1a8fa01 to your computer and use it in GitHub Desktop.
Save christophengelmayer/7aa94a7582ef6934dea9ca49d1a8fa01 to your computer and use it in GitHub Desktop.
Cheatsheet for NEOS CMS

NEOS CMS Cheatsheet

Links

Fusion

Packages

Basic install via Commandline

composer create-project --no-dev --no-install neos/neos-base-distribution #FOLDER#
cd #FOLDER#
composer remove neos/setup neos/demo flowpack/neos-frontendlogin
cp Configuration/Settings.yaml.example Configuration/Settings.yaml
cp Configuration/Development/Settings.yaml.example Configuration/Development/Settings.yaml

Create a database and edit Configuration/Settings.yamland Configuration/Development/Settings.yaml accordingly.

./flow doctrine:migrate
./flow kickstart:site
./flow site:create
./flow user:create --roles=Administrator

Disable unused NodeTypes in ContentCollections

// Configuration/NodeTypes.yaml

'Neos.Neos:ContentCollection':
  constraints:
    nodeTypes:
      'Neos.NodeTypes:TextWithImage': false
      'Neos.NodeTypes:ContentReferences': false
      'Neos.NodeTypes:AssetList': false
      'Neos.NodeTypes:Menu': false
      'Neos.NodeTypes:FourColumn': false

Add viewport meta tag for correct responsive behaviour

// Resources/Private/Fusion/root.fusion

page = Neos.Neos:Page {
  head {
    metadata = Neos.Fusion:Template {
      templatePath = 'resource://My.Site/Private/Templates/Page/Default.html'
      sectionName = 'metadata'
    }
  }
<!-- Resources/Private/Templates/Page/Default.html -->

<head>
  <f:section name="metadata">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
  </f:section>
</head>

Add package stylesheet and javascript

<!-- Resources/Private/Templates/Page/Default.html -->

<f:section name="stylesheets">
    <link rel="stylesheet" href="{f:uri.resource(path: 'Styles/main.css', package: 'RDB.UNWomenUK', localize: false)}" media="all" />
</f:section>

<f:section name="bodyScripts">
    <script type="text/javascript" src="{f:uri.resource(path: 'JavaScript/main.js', package: 'UnWomen.Website', localize: false)}"></script>
</f:section>

Disable all formatting options in aloha editor

http://neos.readthedocs.io/en/stable/CreatingASite/NodeTypes/NodeTypeDefinition.html

ui:
  aloha:
    'format': []
    'table': []
    'link': []
    'list': []
    'alignment': []
    'formatlesspaste':
      'button': false
      'formatlessPasteOption': true

Disable default prototype Generator (HardMode)

'Neos.Neos:Node':
    options:
        fusion:
            prototypeGenerator: ~

Make properties editable using Fusion

    title = Neos.Fusion:Tag {
        tagName = 'span'
        content = ${q(node).property('title')}
        @process.contentElementEditable = ContentElementEditable {
            property = 'title'
        }
    }

Button Fusion

prototype(My.Website:Button) < prototype(Neos.Fusion:Tag) {
    attributes.class = 'btn btn--primary'
    content = ${q(node).property('text')}
    attributes.href = ${q(node).property('link')}
    attributes.href.@process.convertUris = Neos.Neos:ConvertUris

    tagName = Neos.Fusion:Case {
        inBackend {
            condition = ${q(node).context.inBackend}
            renderer = ${'span'}
        }
        notInBackend {
            condition = ${true}
            renderer = ${'a'}
        }
    }

    attributes.target = '_blank'
    attributes.target.@if.onlyIfTargetBlank = ${q(node).property('target') == 'blank'}

	@process.contentElementWrapping = ContentElementWrapping

    @process.layout = Neos.Fusion:Tag{
        tagName = 'div'
        content = ${value}
        attributes.style = 'text-align:center'
    }
    @process.layout.@if.isCentered = ${q(node).property('centered')}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment