我尝试制作一个 apos.pages.find 以在当前页面子项中显示标记的文章。
find 方法适用于标签,但是当我尝试使用 slug 选项限制搜索时,它不匹配。
首先我尝试了一个
apos.pages.find(req).slug("/ils-parlent-de-nous")
但我收到此错误:
.slug("/")
^
TypeError: self.apos.pages.find(...).tag(...).slug is not a function
所以我尝试了这种语法:
module.exports = { label: 'Articles en une', name:"liste-unes", construct: function(self, options) {
self.pageBeforeSend = function(req, callback) {
self.apos.pages.find(req, { slug: { $gte: '/ils-parlent-de-nous' } } )
.tag("la une")
.published()
.ancestors(true)
.sort(
{ createdAt: 1 }
).toArray(function(err, la-une) {
if (err) {
console.log(err)
return callback(err);
}
req.data.la-une = la-une;
console.log("* * * * * * * * * * * * * * * ")
console.log(la-une)
return callback(null);
});
}
}};
我错过了什么吗?
谢谢