我试着用Radiant CMS建立一个简单的博客,但在“归档月份索引”上遇到了问题。我按照这个weblog上的描述设置了它,但是我就是不能让它工作。
代码和视频中使用的那个人是一样的。它是:
<r:archive:children:each>
<div class="blog-post">
<h3><r:link /></h3>
<p>
<r:content />
</p>
</div>
</r:archive:children:each>...for存档索引。
然而,当我访问post/2010/12网站(或任何其他日期)时,我都会感到惊讶。
StandardTags::TagError in SiteController#show_page
Recursion error: already rendering the `body' part.当月索引页的...instead。我只是不能想象我如何渲染身体部位两次。
发布于 2011-02-15 06:30:27
我也有同样的问题。Radiant的安装程序创建的默认博客设置也是如此。
Radiant中的博客页面如下所示:
+ Articles (Archive)
|
+- %B %Y Archives (Archive Month Index)
|
+- First Post
|
+- Second Post
|
+- Third Post文章页面下的所有内容似乎都包含在<r:archive:children:each></r:archive:children:each>返回的结果中。
这意味着如果索引页和第一篇文章是在2011年2月2日创建的,那么URL / process / 2011 / 02 /将抛出此异常,因为正在处理以生成包含2011年2月文章列表的页面的索引页将递归尝试处理自身。
我最终使用的解决方案是从<r:archive:children:each></r:archive:children:each>的结果中筛选出正在处理的页面(即索引页)的<r:unless_self></r:unless_self>标记。
索引页面的非崩溃body页面部分示例如下所示:
<r:archive:children:each order="desc">
<r:unless_self>
<div class="entry">
<h3><r:link /></h3>
<r:content />
</div>
</r:unless_self>
</r:archive:children:each>https://stackoverflow.com/questions/4501043
复制相似问题