Search code examples
blogger

How to optimize title and description tags for blogspot search result (data: blog.searchQuery)?


I want to optimize the title tag and description for blogspot search results with but it doesn't work. Below is the code I tried with the tag.

<b:if cond='data:blog.searchQuery'>
 <title><data:blog.pageTitle/> | Nhà đất Sơn Nghĩa</title>
 <meta content='Kết quả tìm kiếm về &quot;+ data:blog.searchQuery + &quot; tại nhà đất Sơn Nghĩa. Môi giới ký gửi nhà đất quận Gò Vấp và quận 12. name='description'/>
 <meta content='mua ban &quot;+ data:blog.searchQuery + &quot;,' name='keywords'/>
</b:if>

I would appreciate it if you could help me solve this problem!

Thanks very much!


Solution

  • data:blog.searchQuery no longer works, use data:view.search.query

    Also you have to use expr operator before tags content attribute and include a space before + operator with enclosing your text by quotes.

    <b:if cond='data:view.search.query'>
     <title><data:blog.pageTitle/> | Nhà đất Sơn Nghĩa</title>
     <meta expr:content='"Kết quả tìm kiếm về " + data:view.search.query + " tại nhà đất Sơn Nghĩa. Môi giới ký gửi nhà đất quận Gò Vấp và quận 12."' name='description'/>
     <meta expr:content='"mua ban " + data:view.search.query + ","' name='keywords'/>
    </b:if>