Last active
October 9, 2019 07:59
-
-
Save Sebobo/0f08bfdb9576aaacaa0ecede6701494a to your computer and use it in GitHub Desktop.
Revisions
-
Sebastian Helzle revised this gist
Oct 3, 2019 . 2 changed files with 43 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,43 @@ 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 = '' // The required `schema.org` type for this object type = '' // Inherit props from parent object into data. These can be accessed in the renderer via props.data. data = ${props} // All attributes will be applied to the resulting object attributes = Neos.Fusion:DataStructure renderer = Neos.Fusion:DataStructure { '@context' = ${props.context} '@context'.@if.isSet = ${props.context} '@type' = ${props.type} @apply.attributes = ${props.attributes ? Array.filter(props.attributes, attribute => attribute != null) : []} } @if.hasType = ${this.type} } prototype(Neos.Seo:StructuredData.Breadcrumb) < prototype(Neos.Fusion:Component) { items = ${q(documentNode).add(q(documentNode).parents('[instanceof Neos.Neos:Document]')).get()} items.@process.reverse = ${Array.reverse(value)} renderer = afx` <Neos.Seo:StructuredData.RootObject type="BreadcrumbList"> <Neos.Fusion:Map items={props.items} iterationName="iteration" @path="attributes.itemListElement"> <Neos.Seo:StructuredData.Object type="ListItem" attributes.position={iteration.cycle} attributes.name={item.label}> <Neos.Neos:NodeUri node={item} absolute={true} @path="attributes.item"/> </Neos.Seo:StructuredData.Object> </Neos.Fusion:Map> </Neos.Seo:StructuredData.RootObject> ` } File renamed without changes. -
Sebastian Helzle created this gist
Oct 2, 2019 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,28 @@ prototype(Neos.Fusion:DataStructureComponent) < prototype(Neos.Fusion:Component) { prototype(Neos.Fusion:Tag) { @class = 'Neos\\Fusion\\FusionObjects\\DataStructureImplementation' @ignoreProperties = ${['tagName', 'content', 'attributes', 'selfClosingTag', 'omitClosingTag']} '@type' = ${this.tagName} } @process { setContext = ${Array.set(value, '@context', 'http://schema.org')} toJson = ${Json.stringify(value)} wrap = ${'<script type="application/ld+json">' + value + '</script>'} } } prototype(Neos.Seo:StructuredData.Breadcrumb) < prototype(Neos.Fusion:DataStructureComponent) { items = ${q(documentNode).add(q(documentNode).parents('[instanceof Neos.Neos:Document]')).get()} items.@process.reverse = ${Array.reverse(value)} renderer = afx` <BreadcrumbList> <Neos.Fusion:Map items={props.items} iterationName="iteration" @path="itemListElement"> <ListItem position={iteration.cycle} name={item.label}> <Neos.Neos:NodeUri node={item} absolute={true} @path="item"/> </ListItem> </Neos.Fusion:Map> </BreadcrumbList> ` }