Skip to content

Instantly share code, notes, and snippets.

View Sebobo's full-sized avatar
:shipit:
Thinking about things

Sebastian Helzle Sebobo

:shipit:
Thinking about things
View GitHub Profile
@Sebobo
Sebobo / Example.fusion
Created April 7, 2020 10:28
NeosCMS Eel helper to load a file with translations for the current locale as array. This allows for example to use the localisation features of the framework and forward all labels to a frontend app.
prototype(MyVendor.Package:Component.Example) < prototype(Neos.Fusion:Component) {
translations = ${MyVendor.Package.Translation.getTranslations('MyVendor.Package', 'MyJsApp')}
renderer = afx`
<div data-translations={Json.stringify(props.translations)} id="my-cool-app">Loading the app ...</div>
`
}
@Sebobo
Sebobo / default.conf
Last active February 21, 2020 07:21
NGINX Neos CMS setup with includes
charset utf-8;
location ~ /\. {
access_log off;
log_not_found off;
deny all;
}
location = /favicon.ico {
log_not_found off;
@Sebobo
Sebobo / Example.fusion
Created November 29, 2019 10:36
Nested Fusion components in NeosCMS
prototype(My.Example:Component.Example) < prototype(Neos.Fusion:Component) {
inputVar1 = ''
inputVar2 = ${[]}
renderer = Neos.Fusion:Component {
@apply.props = ${props}
customVar = ${Array.join(props.inputVar2, ',') + props.inputVar1}
renderer = afx`
<div>
@Sebobo
Sebobo / Columns.fusion
Last active December 27, 2020 16:13
Preventing deep content nesting in Neos CMS
prototype(My.Site:Component.ContentCollection) < prototype(Neos.Neos:ContentComponent) {
@cache {
mode = 'cached'
entryIdentifier {
collection = ${node}
}
entryTags {
1 = ${Neos.Caching.descendantOfTag(node)}
2 = ${Neos.Caching.nodeTag(node)}
}
@Sebobo
Sebobo / WithFusionHelperComponents.fusion
Last active October 9, 2019 07:59
Structured data tags in Neos CMS
prototype(Neos.Seo:StructuredData.RootObject) < prototype(Neos.Seo:StructuredData.Object) {
context = 'http://schema.org'
@process.toJson = ${Json.stringify(value)}
@process.wrap = ${'<script type="application/ld+json">' + value + '</script>'}
}
prototype(Neos.Seo:StructuredData.Object) < prototype(Neos.Fusion:Component) {
// Optional context. Usually "http://schema.org" for root objects
context = ''
@Sebobo
Sebobo / example.org.conf
Created June 9, 2019 13:15
Neos CMS NGINX example configuration
server {
listen 80;
listen [::]:80;
server_name example.org;
charset utf-8;
client_max_body_size 50M;
root /var/www/example.org/releases/current/Web/;
index index.php;
@Sebobo
Sebobo / FileSystemSymlinkTarget.php
Last active May 15, 2019 07:49
Use asset title as filename in Neos CMS
<?php
namespace My\Package\ResourceManagement\Target;
use Neos\Flow\Annotations as Flow;
use Cocur\Slugify\Slugify;
use Neos\Flow\ResourceManagement\ResourceMetaDataInterface;
use Neos\Media\Domain\Repository\AssetRepository;
/**
* A target which publishes resources by creating symlinks with the filename based on the files title.
@Sebobo
Sebobo / example.php
Last active March 23, 2020 13:01
Example Neos Deployment config for TYPO3 Surf 2.0
<?php
$node = new TYPO3\Surf\Domain\Model\Node('production');
$node
->setHostname('my.node.com')
->setOption('username', 'myuser');
$application = new TYPO3\Surf\Application\Neos\Neos('My Node');
$application
->setOption('keepReleases', 3)

Keybase proof

I hereby claim:

  • I am sebobo on github.
  • I am sebobo (https://keybase.io/sebobo) on keybase.
  • I have a public key ASCJpSUEhA4FB3VnJnvM2PqNKdgf9QSuJkg77FfvgzH3_wo

To claim this, I am signing this object:

@Sebobo
Sebobo / AfxMenu.fusion
Last active November 9, 2018 10:05
Afx based menu for Neos CMS
prototype(Example:Navigation) < prototype(Neos.Fusion:Component) {
startingPoint = ${site}
depth = 0
maxDepth = 99
items = ${q(this.startingPoint).children('[instanceof Neos.Neos:Document][_hiddenInIndex=false]').get()}
renderer = afx`
<ul>
<Neos.Fusion:Collection collection={props.items} itemName="item" @children="itemRenderer">