Use Blogger Label Tags as Metadata Keywords

I'm starting to create blogger templates from scratch and I'm doing research on the best SEO metadata for every post. I think the most logical way to use meta name = keywords is to use post tags as keywords, but I don't understand why I can't get the data and display it in the meta section as much as I can from the data from the description. for example:

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

      

puts data coming from blog.metaDescription as content for meta description, but when I want to use:

<meta expr:content='data:post.labels.name' name='keywords' />

      

What the data fetched from the postmarks should be, it doesn't display anything ... as if there is no such data ... I'm wondering why please help ... I'm going crazy, I tried a lot of things and I can't use email labels as meta keywords.

Regards

+3


source to share


2 answers


You can get post tags inside the Blog Posts widget <b:widget type='Blog' ...>

, and this is through a loop tag like the following

<b:loop values='data:post.labels' var='label'>
    <data:label.name/>
</b:loop>

      



Or you can also use lambda expression

<b:eval expr='data:post.labels map (label => label.name)'/>

      

+1


source


The following code should work -

&lt;meta content=&quot;<b:loop values='data:post.labels' var='label'><data:label.name/><b:if cond='not data:label.isLast'>,</b:if></b:loop>&quot; name='keywords'/&gt;

      



But the downside is that it will only work in the mail area (present inside the tag <body>

) and not in the area<head>

0


source







All Articles