将博客文章标签用作元数据关键字 [英] Use blogger post labels as meta data keywords
问题描述
我开始从头开始制作博客模板,并且正在研究有关每个帖子的最佳SEO元数据.我认为使用meta name = keywords的最合乎逻辑的方法是使用帖子标签作为关键字,但是我不明白为什么我无法检索数据并将其显示在meta部分中,因为我可以使用描述中的数据.例如:
I am starting to make blogger templates from scratch and i am making a research about best SEO metadata for each post. I think the most logical way to use meta name=keywords is to use post labels as keywords but i don't understand why i cant retrieve the data and display it in the meta section as i can with the data from description. for expample:
<b:if cond='data:blog.pageType != "error_page"'>
<meta expr:content='data:blog.metaDescription' name='description'/>
</b:if>
将来自blog.metaDescription的数据作为元描述的内容,但是当我想使用时:
puts the data comming from blog.metaDescription as content for meta description, but when i want to use:
<meta expr:content='data:post.labels.name' name='keywords' />
应该是从帖子标签中检索到的数据,它什么也不显示...好像没有此类数据...我不知道为什么请帮忙...我对此非常生气,我尝试过很多东西,我不能完成使用后标签作为元关键字.
Which should be the data retrieved from the post labels, it doesn't display anything... as if there is no such data... i wonder why please help ... i am going mad with this, i tried a lot of stuff and i cant accomplish to use post labels as meta keywords.
最好的问候
推荐答案
您只能在Blog Posts小部件<b:widget type='Blog' ...>
中检索帖子标签,并且只能通过如下所示的循环标签
You can only retrieve post labels inside Blog Posts widget <b:widget type='Blog' ...>
and that is through a loop tag like the following
<b:loop values='data:post.labels' var='label'>
<data:label.name/>
</b:loop>
或者您也可以使用lambda表达式
Or you can also use a lambda expression
<b:eval expr='data:post.labels map (label => label.name)'/>
这篇关于将博客文章标签用作元数据关键字的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!