问题描述
我的问题是,如何将同一标签下的帖子的网址和标题存储到字符串数组中。
假设我在标签下有许多帖子,请
据推测,该 Category 或标签下的标题和网址为: b
$ b
第2章: b
$ b
发布3:
和其他一些...
我想要两个数组像 var pTitle 和 var pURL
,我希望它可以像这样存储
<$ p第1章
pTitle [1] = Konjiki no WordMaster第2章
pTitle [2] =地下城探索者第1章
pURL [0] = http://rawmangaread.blogspot.in/2017/03/konjiki-no-wordmaster-chapter-1.html
pURL [1] = http://rawmangaread.blogspot.in/2017/03/konjiki-no-wordmaster-chapter-2.html
pURL [2] = http://rawmangaread.blogspot.in/2017/03/dungeon -seeker-chapter-1-raw-manga.html
请通过提供代码来帮助您:D
以下代码应该能够实现您所需的功能 -
< b:if cond ='data:blog.searchLabel'>
< script>
var URLArray =< b:eval expr ='data:posts map(post =& gt; post.url)'/> ;;
var TitleArray =< b:eval expr ='data:posts map(post =& gt; post.title)'/> ;;
< / script>
< / b:if>
b:if 标签页上的代码。此外,为了使它工作,将其放置在 Blog 小工具中(将它添加到< b:includable id ='main'var ='不要将它包含在 b:loop 标签中,或者它会在页面上重复多次)
The question I have is, how to store the URL's and Titles of the posts under the one and the same label into a String array.
Suppose I have a number of posts under the label Action http://rawmangaread.blogspot.in/search/label/Action/
And supposedly the posts Titles and URL's under that Category or Label are :
Post 2:
Post 3:
and some others...I want 2 arrays like var pTitle and var pURLand I want it to store like this
pTitle[0]=Konjiki no WordMaster Chapter 1 pTitle[1]=Konjiki no WordMaster Chapter 2 pTitle[2]=Dungeon Seeker Chapter 1 pURL[0]=http://rawmangaread.blogspot.in/2017/03/konjiki-no-wordmaster-chapter-1.html pURL[1]=http://rawmangaread.blogspot.in/2017/03/konjiki-no-wordmaster-chapter-2.html pURL[2]=http://rawmangaread.blogspot.in/2017/03/dungeon-seeker-chapter-1-raw-manga.html
Please Help by providing a Code :D
The following code should be able to achieve what you require -
<b:if cond='data:blog.searchLabel'> <script> var URLArray = <b:eval expr='data:posts map (post => post.url)'/>; var TitleArray = <b:eval expr='data:posts map (post => post.title)'/>; </script> </b:if>
The b:if condition only loads this code on Label pages. Also, to make it work, place this inside the Blog gadget (Add it inside the <b:includable id='main' var='top'> tag. Don't include it inside the b:loop tag for posts or it will get repeated multiple times on a page)
这篇关于如何将同一标签下的帖子列表的URL和标题存储到Blogger中的字符串数组中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!