限制 Blogger 上每个标签的帖子数量
Limit the number of posts per tag on Blogger
我有这段代码可以在博客上按标签显示帖子。
有谁知道帮我格式化一下让它只显示 4 个帖子吗?
代码搜索博主 XML 现有帖子,但仅显示包含代码中指定标签的帖子。
<div id="div-2">
<b:section id='posts-noticias'>
<b:widget id='Blog2' locked='true' title='Blog Archive' type='Blog'>
<b:includable id='main' var='top'>
<b:loop values='data:posts' var='post'>
<b:if cond='data:blog.url == data:blog.homepageUrl'>
<b:if cond='data:post.labels'>
<b:loop values='data:post.labels' var='label'>
<b:if cond='data:label.name == "NOTÍCIAS"'>
<b:include data='post' name='printPosts'/>
</b:if>
</b:loop>
</b:if>
<b:else/>
<b:include data='post' name='printPosts'/>
</b:if>
</b:loop>
</b:includable>
<b:includable id='printPosts' var='post'>
<b:if cond='data:post.dateHeader'>
<h2 class='date-header'>
<data:post.dateHeader/>
</h2>
</b:if>
<b:include data='post' name='post'/>
<b:if cond='data:blog.pageType == "static_page"'>
<b:include data='post' name='comments'/>
</b:if>
<b:if cond='data:blog.pageType == "item"'>
<b:include data='post' name='comments'/>
</b:if>
</b:includable>
</b:widget>
</b:section>
<b:includable id='main' var='top'>
<b:if cond='data:view.isHomepage'>
<b:loop values='data:posts where (p=> p.labels any (l=> l.name == "NOTÍCIAS")) take 4' var='post'>
<b:include data='post' name='printPosts'/>
</b:loop>
<b:else/>
<b:loop values='data:posts' var='post'>
<b:include data='post' name='printPosts'/>
</b:loop>
</b:if>
</b:includable>
我有这段代码可以在博客上按标签显示帖子。
有谁知道帮我格式化一下让它只显示 4 个帖子吗?
代码搜索博主 XML 现有帖子,但仅显示包含代码中指定标签的帖子。
<div id="div-2">
<b:section id='posts-noticias'>
<b:widget id='Blog2' locked='true' title='Blog Archive' type='Blog'>
<b:includable id='main' var='top'>
<b:loop values='data:posts' var='post'>
<b:if cond='data:blog.url == data:blog.homepageUrl'>
<b:if cond='data:post.labels'>
<b:loop values='data:post.labels' var='label'>
<b:if cond='data:label.name == "NOTÍCIAS"'>
<b:include data='post' name='printPosts'/>
</b:if>
</b:loop>
</b:if>
<b:else/>
<b:include data='post' name='printPosts'/>
</b:if>
</b:loop>
</b:includable>
<b:includable id='printPosts' var='post'>
<b:if cond='data:post.dateHeader'>
<h2 class='date-header'>
<data:post.dateHeader/>
</h2>
</b:if>
<b:include data='post' name='post'/>
<b:if cond='data:blog.pageType == "static_page"'>
<b:include data='post' name='comments'/>
</b:if>
<b:if cond='data:blog.pageType == "item"'>
<b:include data='post' name='comments'/>
</b:if>
</b:includable>
</b:widget>
</b:section>
<b:includable id='main' var='top'>
<b:if cond='data:view.isHomepage'>
<b:loop values='data:posts where (p=> p.labels any (l=> l.name == "NOTÍCIAS")) take 4' var='post'>
<b:include data='post' name='printPosts'/>
</b:loop>
<b:else/>
<b:loop values='data:posts' var='post'>
<b:include data='post' name='printPosts'/>
</b:loop>
</b:if>
</b:includable>