问题
I am trying to figure out how to use the data:post.snippet function in blogger to bypass the Settings > Search preferences > Meta tags > Description or post Search Description that is being used as the variable for metaDescription.
The snippet function would be a great way to set the description for facebook and twitter.
Is there anyway to pickup the snippet as a data:blog variable?
<b:if cond='data:blog.metaDescription != ""'>
<meta expr:content='data:post.snippet' property='og:description'/>
<meta expr:content='data:blog.snippet' name='twitter:description'/>
<meta expr:content='data:blog.metaDescription' itemprop='description'/>
<meta expr:content='data:blog.metaDescription' name='description'/>
回答1:
Unfortunately, data:post.snippet
works only in <b:widget type='Blog'>...</b:widget>
section.
回答2:
I know it's bit too late to answer this, but since I was also searching a solution for same and have found the one working, here it is.
Post the following code within the <head>
section of your blogger template:
<b:if cond='data:blog.metaDescription'>
<meta expr:content='data:blog.metaDescription' name='og:description'/>
</b:if>
Cheers!
回答3:
I have tested and found that the data:post.snippet denotes the meta description for a post. Provided you have filled the Text box in the Search description while writing the blog post.
来源:https://stackoverflow.com/questions/28280312/blogger-datapost-snippet-to-replace-datablog-metadescription-for-descripti