Blogger - data:post.snippet to replace data:blog.metaDescription for *:description

江枫思渺然 提交于 2020-01-05 08:21:37

问题


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 != &quot;&quot;'>
<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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!