Asiri Liyana Arachchi
Asiri Liyana Arachchi

Reputation: 2673

How to feed desired data to Layout Data Tags in Blogger

In the template which I've used for my blog this js method

document.write(bp_thumbnail_resize(&quot;<data:post.thumbnailUrl/>&quot;,&quot;<data:post.title/>&quot;)) 

is used to add a thumbnail to each post as far as I understood. But I don't know how to make post.thumbnailUrl to hold the image url that I want to add to the the post.

My blog . You'll see there are only the posts with out the thumbnails.

Thanks

Upvotes: 1

Views: 330

Answers (2)

Asiri Liyana Arachchi
Asiri Liyana Arachchi

Reputation: 2673

Latter figured out that post.thumbnailUrl takes the first image appears in the post if it fits required image size. With the first template I used it didn't work out well. After choosing a different template the problem was solved.

Upvotes: 1

Asiri Liyana Arachchi
Asiri Liyana Arachchi

Reputation: 2673

I used a simple js script to do this.

    var t2 = &quot; <data:post.title/> &quot;;
    if(t2== &quot; COD Server Setup &quot;){
         var e = &quot;https://lh4.googleusercontent.com/-PIcMPlHmFt4/UlkBYbUzOtI/AAAAAAAAAQE/6I26Y6aNnPM/w540-h390-no/CSESign.jpg&quot;;}
    else if(t2== &quot; Same thing &quot;){
         e = &quot;https://lh4.googleusercontent.com/-162ZlFQDm1w/Ulj-NoFTknI/AAAAAAAAAPQ/NwTG2lHXROE/w180-h130-no/sample1.jpg&quot;;}
    else if(t2== &quot; Testing Post &quot;){
         e = &quot;https://lh4.googleusercontent.com/-162ZlFQDm1w/Ulj-NoFTknI/AAAAAAAAAPQ/NwTG2lHXROE/w180-h130-no/sample1.jpg&quot;;}
    else{
         e = &quot; &quot;;
        }    

  document.write(bp_thumbnail_resize( e,&quot;<data:post.title/>&quot;));

When using this I have to edit the code each time when a new post is added in order to add a thumbnail to the post.

Upvotes: 1

Related Questions