aertmann
(Aske Ertmann)
May 5, 2017, 2:06pm
11
If you’re interested in an example of how to use the Listable package for articles, neos.io has a implementation for the blog and it’s available in a public repository.
prototype(Neos.NeosIo:Post) {
author = ${this.authors ? Data.users(this.authors) + this.authorAlternative : this.authorAlternative}
content = PrimaryContent {
nodePath = 'main'
}
backToListButton = Neos.NeosIo:Button {
style = 'btn--solidPrimary'
buttonLabel = 'Back to list'
alignment = 'Right'
link = Neos.Neos:NodeUri {
node = ${q(node).parents('[instanceof Neos.NodeTypes:Page]').get(0)}
absolute = true
}
@process.contentElementWrapping >
}
latest = ${q(site).find('[instanceof Neos.NeosIo:Post]').slice(0, 6).sort('datePublished', 'DESC').get()}
}
This file has been truncated. show original
postRss = Neos.Fusion:Http.Message {
feed = Neos.Fusion:Template {
templatePath = 'resource://Neos.NeosIo/Private/Templates/FusionObjects/PostRss.xml'
posts = ${q(site).find('[instanceof Neos.NeosIo:Post]').sort('datePublished').slice(0, 20).get()}
site = ${site}
@cache {
mode = 'cached'
entryIdentifier {
identifier = 'postRss'
}
entryTags {
1 = ${'NodeType_Neos.NeosIo:Post'}
}
}
}
httpResponseHead.headers.Content-Type = 'application/xml'
}
prototype(Neos.NeosIo:Post.Document) < prototype(Neos.NeosIo:DefaultPage) {
head {
@context.metaDescription = ${String.crop(String.stripTags(q(node).property('summary')) ? String.stripTags(q(node).property('summary')) : q(node).property('metaDescription'), 152, '...')}
metaDescriptionTag {
attributes.content = ${metaDescription}
@if.isNotBlank = ${!String.isBlank(metaDescription)}
}
twitterCard = Neos.Fusion:Array {
@if.isEnabledBlank = 1
@if.isEnabled = 1
cardTypeTag.attributes.content = 'summary'
cardTitleTag {
attributes.content = ${String.crop(String.stripTags(q(node).property('title')), 67, '...')}
@if.isNotBlank = 1
}
This file has been truncated. show original
{namespace neos=Neos\Neos\ViewHelpers}{namespace media=Neos\Media\ViewHelpers}{namespace ts=Neos\Fusion\ViewHelpers}
<article>
<header>
<neos:contentElement.wrap node="{node}">
<neos:contentElement.editable property="title" tag="h1" additionalAttributes="{itemprop: 'title'}" class="u-alignCenter" />
<neos:contentElement.editable property="summary" tag="p" class="u-alignCenter" additionalAttributes="{itemprop: 'description'}"/>
<p class="u-alignCenter u-microCopy">
<time datetime="{datePublished -> f:format.date(format: 'c')}" itemprop="datePublished">{datePublished
-> f:format.date(localeFormatType: 'date', forceLocale: true)}
</time>
<f:if condition="{author}">
– Written by
<span itemprop="author" itemscope="" itemtype="https://schema.org/Person"><span itemprop="name">{author}</span></span>
</f:if>
<f:if condition="{image}">
<meta itemprop="image" content="{media:uri.image(image: image, maximumWidth: 720, maximumHeight: 500, allowCropping: 1, allowUpScaling: 1)}"/>
</f:if>
</p>
This file has been truncated. show original
{namespace neos=Neos\Neos\ViewHelpers}
<neos:link.node node="{post}" class="u-linkReset u-mb1/1 u-cf">
<div>{post.properties.datePublished -> f:format.date(localeFormatType: 'date', forceLocale: true)}</div>
<h3 class="h1 u-w11/12 u-mb0">{post.properties.title -> f:format.stripTags()}</h3>
<p class="u-w9/12 u-mt1/2">{post.properties.summary -> f:format.raw()}</p>
</neos:link.node>
{button -> f:format.raw()}
{namespace neos=Neos\Neos\ViewHelpers}<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
<channel>
<title>Neos - Feed</title>
<link><neos:uri.node node="{site}" format="html" absolute="1" /></link>
<description>Neos blog posts</description>
<language>en</language>
<lastBuildDate>{f:format.date(date: 'now', format: 'D, d M Y H:i:s O')}</lastBuildDate>
<f:if condition="{f:count(subject: posts)} > 0"><f:for each="{posts}" as="post"><item>
<title>{post.properties.title -> f:format.stripTags()}</title>
<link><neos:uri.node node="{post}" format="html" absolute="1" /></link>
<description><f:format.stripTags value="{post.properties.summary -> f:format.stripTags()}" /></description>
<pubDate>{f:format.date(date: post.properties.datePublished, format: 'D, d M Y H:i:s O')}</pubDate>
<guid>{post.identifier}</guid>
</item></f:for></f:if>
</channel>
</rss>
{namespace neos=Neos\Neos\ViewHelpers}
{namespace media=Neos\Media\ViewHelpers}
<neos:link.node node="{node}" class="u-linkReset">
<div class="u-microCopy">{datePublished -> f:format.date(localeFormatType: 'date', forceLocale: true)}</div>
<h3 class="u-mt0 u-mb1/2 u-brandColor-primary">{title -> f:format.stripTags()}</h3>
<div class="media">
<f:if condition="{image}">
<f:if condition="{neos:rendering.inBackend()}">
<f:then>
<img
alt="{title -> f:format.stripTags()}"
class="media__img media__img--scaled u-mb1/1"
src="{media:uri.image(image: image, width: 1000, height: 250, allowCropping: true)}"
width="{image.width}"
height="{image.height}"
srcset="
{media:uri.image(image: image, width: 1000, height: 250, allowCropping: true)} 1920w,
{media:uri.image(image: image, width: 700, height: 175, allowCropping: true)} 1280w,
{media:uri.image(image: image, width: 400, height: 100, allowCropping: true)} 658w,
This file has been truncated. show original
Be aware that it’s using the version prior to the refactoring @dimaip mentioned.