lelesys / news
Neos 新闻插件
4.0.9
2022-11-08 09:03 UTC
Requires
- neos/neos: ^5.0 || ^7.0
README
请通过以下链接查找文档
尽管这是第一个版本,但它仍然有效。
NeosCMS 4.0 支持
默认情况下,Neos 站点启动器不再创建类似 "page = Neos.Neos:Page" 的页面对象,而是根据您的站点包密钥创建单独的 Page nodetype,例如 My.Site:Page。
为了使新闻包正常工作,您需要在您的站点根目录下的 Root.fusion 中添加以下行
prototype(Lelesys.News:Folder) < prototype(My.Site:Page)
prototype(Lelesys.News:Category) < prototype(My.Site:Page)
prototype(Lelesys.News:News) < prototype(My.Site:Page)
在 Fusion 中,如果您的主体内容对象路径与 body.content.main 不同,您可以这样做来覆盖它
prototype(Lelesys.News:News) {
body.content.something = Lelesys.News:NewsRenderer
}
使用 Elasticsearch
为了加快处理新闻过滤和排序,建议使用 Elasticsearch。
如果您已安装 flowpack/elasticsearch-contentrepositoryadaptor
(及其依赖项),新闻将被正确索引。如果您在安装 Elasticsearch 驱动程序之前已创建新闻,请运行 ./flow nodeindex:build
以创建索引。
要将插件配置为使用 Elasticsearch 检索新闻,请将以下内容添加到您的 TypoScript 中
prototype(Lelesys.News:List) {
newsCollection = Lelesys.News:ElasticsearchNewsCollector
}
prototype(Lelesys.News:Latest) {
newsCollection.value.@process.slice = ${value.limit(String.toInteger(configuration.numberOfItems))}
newsCollection.value.@process.toArray = ${value.toArray()}
newsCollection.value.@process.toArray.@position = 'after execute'
}
列表视图最多检索 1000 项(在应用分页之前!),这可以通过以下方式调整
newsCollection = Lelesys.News:ElasticsearchNewsCollector {
value.@process.limit = ${value.limit(42)}
}
要启用对发送到 Elasticsearch 的查询的记录(Data/Logs/ElasticSearch.log
),您可以这样做
newsCollection = Lelesys.News:ElasticsearchNewsCollector {
value.@process.log = ${value.log()}
value.@process.log.@position = 'before execute'
}
类似地,您可以通过添加更多过滤器来调整查询,收集器中的 value
是 ElasticSearchQueryBuilder
的实例
newsCollection = Lelesys.News:ElasticsearchNewsCollector {
# exclude "hidden in menu" entries from the List`s news collection
value.@process.filterHiddenInIndex= ${value.queryFilter('term', {'_hiddenInIndex': true}, 'must_not')}
value.@process.filterHiddenInIndex.@position = 'before execute'
}