Skip to content Skip to sidebar Skip to footer

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:ifcond='data:blog.searchLabel'><script>varURLArray = <b:evalexpr='data:posts map (post =&gt; post.url)'/>;
    varTitleArray = <b:evalexpr='data:posts map (post =&gt; 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"