'meta description tag automatically

I am trying to add meta tag for description when it is missing in the posts. I want first 150 characters to be considered as description. I tried with multiple methods but does not work.

1st Method

<b:tag name='script' type='text/javascript'> 

var msg = &quot;<b:eval expr='snippet(data:post.body, {length: 150, links: false})'/>&quot;;  
var metaDescription = document.head.children.description;
if (metaDescription == null) {
  metaDescription = document.createElement(&#39;meta&#39;);
  metaDescription.name = &#39;description&#39;;
  document.head.append(metaDescription);
}
metaDescription.content = msg;
console.log(msg);  
  
</b:tag>

  

2nd Method

<b:if cond='data:blog.pageType == &quot;item&quot;'>
        <b:if cond='data:blog.metaDescription == &quot;&quot;'>
         <meta expr:content='data:post.longSnippet' name='description'/>
        </b:if>      
      </b:if>

3rd Method

  <b:if cond='data:blog.pageType == &quot;item&quot;'>
    <b:if cond='data:blog.metaDescription == &quot;&quot;'>
     <meta expr:content='snippet(data:post.body, {length: 150, links: false})' name='description'/>
    </b:if>      
  </b:if>
  


Solution 1:[1]

<b:eval expr='data:post.body snippet { length: 140 }'/>

example: https://skeleton001.blogspot.com/

enter image description here

source: https://geekthis.net/post/blogger-theme-data-tags-for-widgets/

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 therkut