ghost-blog - Ghost:在 foreach 循环中获取帖子的 URL
问题描述
我正在寻找使用{{#foreach posts}}{{/foreach}}
帮助程序访问的帖子的 URL。我现在使用的结构是:
<div class="pfdflxbx">
{{#get "posts" limit="3" include="tags, authors" filter="featured:true"}}
{{#foreach posts limit="3"}}
{{title}}
{{/foreach}}
{{/get}}
</div>
当我在和之间插入{{url}}
助手时,返回给我的 URL 是网站主页的 url。{{title}}
{{/foreach}}
如果我使用以下结构:
<div class="pfdflxbx">
{{#get "posts" limit="3" include="tags, authors" filter="featured:true"}}
{{#foreach posts limit="3"}}
{{#post}}
{{title}}
{{/post}}
{{/foreach}}
{{/get}}
</div>
没有任何东西呈现给 DOM,例如,没有帖子填充。
有人可以帮助阐明这里的正确做法吗?
解决方案
我发布的第一个解决方案是正确的。我正在使用的后端版本中存在一个错误,导致博客帖子的 URL 重定向到欢迎页面。
推荐阅读
- glsl - 使用 pixi-js 在 GLSL 中进行纹理缩放
- javascript - GoJS 调整图表每个元素的大小
- html - 两个相同的html元素有不同的尺寸
- python - 查找 Xpath 对每个登录都是唯一的元素
- python - 如何在pdf中提取输入字段的x0,y0坐标
- flutter - 在 DataTable 中显示所选单元格的详细数据
- java - 带有@Param null 参数的 JPA 仍然抛出错误
- javascript - 如何重新启动已设置间隔的倒数计时器?Javascript
- azure - 如何将 Ubuntu VM 从 Digital Ocean 迁移到 Azure
- reactjs - 材质 UI 工具提示未在嵌套组件上呈现