Setting the Maximum Title Length: Blogspot

544 Views Asked by At

can i set maximum title length in blogspot index page? If the title exceeds the maximum length, the letters or words which do not fit are replaced with "...". And only in index, the original title still the same if you go to the post.

            <h4 class='title'><a expr:href='data:post.href' rel='bookmark'><data:post.title/></a></h4>
1

There are 1 best solutions below

0
On

Yes, you can set title length in index pages by javascript. Paste this code before </body>. You can change the maximum length 30.

<b:if cond='data:blog.pageType == "index"'>
<script type="text/javascript">
//<![CDATA[
$(".title").each(function(){
    if($(this).text().length>30)
    {$(this).text($(this).text().substr(0, 30)+'...');}
});    
//]]>
</script>
</b:if>