Radiant:“档案月份索引”
我尝试使用 Radiant CMS 建立一个简单的博客,但“存档月份索引”有问题。 我按照博客上的描述进行了设置,但我就是无法让它工作。
该代码与视频中的人使用的代码相同。它是:
<r:archive:children:each>
<div class="blog-post">
<h3><r:link /></h3>
<p>
<r:content />
</p>
</div>
</r:archive:children:each>
......档案索引。
然而,当我进入 post/2010/12 网站(或任何其他日期)时,我得到了令人惊奇的结果
StandardTags::TagError in SiteController#show_page
Recursion error: already rendering the `body' part.
......而不是该月的索引页。我只是想不出如何将身体部分渲染两次。
I trying to set up a simple blog with Radiant CMS and have a problem with the "Archive Month Index".
I set it up as it is described on this weblog but I just can't get it to work.
The Code is the the same as the guy in the video st using. It's:
<r:archive:children:each>
<div class="blog-post">
<h3><r:link /></h3>
<p>
<r:content />
</p>
</div>
</r:archive:children:each>
...for the Archive Index.
However when I go onto the post/2010/12 site (or any other date) I get that amazing
StandardTags::TagError in SiteController#show_page
Recursion error: already rendering the `body' part.
...instead of the Index Page for the month. I just can't think of how I am rendering the body part twice.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我有完全相同的问题。 Radiant 安装程序创建的默认博客设置也是如此。
Radiant 中的博客页面看起来类似于:
“文章”页面下的所有内容似乎都包含在
返回的结果中>。这意味着,如果索引页面和第一篇文章是在 2011 年 2 月 2 日创建的,则 URL /articles/2011/02/ 将引发此异常,因为索引页面正在处理以生成包含 2011 年 2 月的文章列表的页面将递归地尝试处理自身。
我最终使用的解决方案是
标签,用于从< 的结果中筛选正在处理的页面(即索引页)。 r:archive:children:each>
。索引页的非崩溃
body
页面部分示例如下所示:I had exactly the same problem. So too do the default blog setups created by Radiant's installer.
The blog pages in Radiant looks something like:
Everything under the Articles page seems to be included in the results returned by
<r:archive:children:each></r:archive:children:each>
.This means that if the index page and the first post were created on Feb 02 2011, then the URL /articles/2011/02/ will throw this exception because the index page being processed to generate a page with a list of articles from Feb 2011 will recursively attempt to process itself.
The solution I wound up using is the
<r:unless_self></r:unless_self>
tags to winnow the page being processed (i.e. the index page) from the results of<r:archive:children:each></r:archive:children:each>
.An example non-crashing
body
page part for the index page would look something like this: