How to create blogger post summary without thumbnail image
Table of Contents
Mobile version on homepage made by <data:post.snippet> and make summary post easy to see of all posts.
How to make homepage simple post and make sumarry post in desktop view in blogger this code js for summary post :
Open template editor and Put below code on blogger post template in head tage between <head> js code</head>
And changing second <data:post.body> with below code js blogger :
<script type=’text/javascript’>
snippet_count = 180;
//<![CDATA[
function removeHtmlTag(strx,chop){
if(strx.indexOf(“<“)!=-1)
{
var snippet = strx.split(“<“);
for(var i=0;i<snippet.length;i++){
if(snippet[i].indexOf(“>”)!=-1){
snippet[i] = snippet[i].substring(snippet[i].indexOf(“>”)+1,snippet[i].length);
}
}
strx = snippet.join(“”);
}
chop = (chop < strx.length-1) ? chop : strx.length-2;
while(strx.charAt(chop-1)!=’ ‘ && strx.indexOf(‘ ‘,chop)!=-1) chop++;
strx = strx.substring(0,chop-1);
return strx+’…’;
}
function createSnippet(pID){
var div = document.getElementById(pID);
var summ = snippet_count;
var summary = ‘<div class=”snippets”>’ + removeHtmlTag(div.innerHTML,summ) + ‘</div>’;
div.innerHTML = summary;
}
//]]>
</script>
And changing second <data:post.body> with below code js blogger :
<div expr:id=’"summary" + data:post.id’><data:post.body/></div>And Save your blogger template editor. To change Summary snippet character in snippet_count and change with 200 or what you like. Thanks.
<script type=’text/javascript’>createSnippet("summary<data:post.id/>");</script>
Post a Comment