If your post in blogger is too long and you don't want to show all your topic on the wall of blogger. You'll think about the READMORE but in the blogger doesn't have this feature so we must put some code in your template.
I will show you the easy way to make a READMORE in your blogger.
Step 1: Go to tab Design->Edit HTML-> Download Full Template.
Step 2: Use the program that could open the file we've just download and edit it.
Step 3: Find the </head> and put this code in front of </head>
<b:if cond='data:blog.pageType != "item"'>
<script type='text/javascript'>//<![CDATA[function strip(s,n){return s.replace(/<.*?>/ig, '').split(/\s+/).slice(0,n-1).join(' ')}
function createSummary(id) { var p = document.getElementById(id), content = p.innerHTML; if (/<!--\s*more\s*-->/.test(content)) { p.innerHTML = content.split(/<!--\s*more\s*-->/)[0]; } else { var imgTag = ”, img = p.getElementsByTagName(‘img’); if (img.length >= 1) { imgTag = ‘<img src=”‘+img[0].src+‘” />’; } p.innerHTML = imgTag + strip(content, 125) + ‘…’; } } //]]> </script> </b:if>
Note: The thumbnail will have a class CSS .thumb. Put this code in front of ]]></b:skin
.thumb{display:inline;margin:5px 10px 10px 0;width:120px}
Step 4: Find the <data:post.body/> and replace it by this code:
<b:if cond='data:blog.pageType != "item"'>
<span expr:id='"p" + data:post.id'><data:post.body/></span>
<script type='text/javascript'>createSummary("p<data:post.id/>");</script>
<a expr:href='data:post.url' title='Read More'>Read More &rarr;</a>
<b:else/>
Step 5: After the edition you save it and Go to tab Design->Edit HTML->Browse and Upload it. Done!<data:post.body/> </b:if>
No comments:
Post a Comment