![](/img/trans.png)
[英]Limitation in the number of posts to fetch with Blogger API (error 400)
[英]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>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.