【发布时间】:2017-10-02 19:43:35
【问题描述】:
我正在使用 apostrophe-blog 模块在我的网站上创建博客。我了解如何在我的 apostrophe-blog-pages/views/index.html 页面上包含每个博客的预览。我想在我的主页上包含我最近发布的博客的预览。有没有办法为我的主页获取我的撇号博客数据?
【问题讨论】:
标签: apostrophe-cms
我正在使用 apostrophe-blog 模块在我的网站上创建博客。我了解如何在我的 apostrophe-blog-pages/views/index.html 页面上包含每个博客的预览。我想在我的主页上包含我最近发布的博客的预览。有没有办法为我的主页获取我的撇号博客数据?
【问题讨论】:
标签: apostrophe-cms
安装apostrophe-blog-widgets(apostrophe-blog 捆绑包的一部分)后,您可以通过在主页模板中的某处添加单例来将博客小部件添加到主页,例如
{{ apos.singleton(data.page, 'blogPreview', 'apostrophe-blog') }}
然后将小部件配置为从 All 中拉取,限制为 1,这将拉取最近的帖子。
通过覆盖lib/modules/apostrophe-blog/lib/modules/apostrophe-blog-widgets/widget.html自定义视图
【讨论】: