How To Store The URL's And Titles Of A List Of Posts Under Same Label Into A String Array In Blogger
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
Solution 1:
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)
Post a Comment for "How To Store The URL's And Titles Of A List Of Posts Under Same Label Into A String Array In Blogger"