none
New meta tags in HEAD for the search keyword(s) and number of hits? RRS feed

  • Question

  • Have a requirement for adding two new meta tags in the search result page. Two separate meta tags, one with the keyword(s) that user search as content, the other meta tag having the number of hits for that search. I.e.:

    <META name="keywords" content="[the keywords]">

    and

    <META name="results" content="[number of hits]">

     

    Any suggestion for how we easily can achieve this?


    regards .r
    Monday, May 9, 2011 7:10 AM

Answers

  • This is out of scope for this forum, but you could create a web part or custom control which adds those two fields to the header of the results.aspx page. Or create your own results.aspx file with the added fields and functionality.

    Or you can edit the page template for the result page and add something like the following to the header section:

    <meta name="content" content="<%= SharedQueryManager.GetInstance(this.Page).QueryManager[0].TotalResultsIncludingDuplicates%>" />

    Regards,
    Mikael Svenson 


    Search Enthusiast - MCTS SharePoint/WCF4/ASP.Net4
    http://techmikael.blogspot.com/ - http://www.comperiosearch.com/p>
    • Proposed as answer by Thomas SvensenModerator Wednesday, May 11, 2011 7:51 PM
    • Marked as answer by .r Thursday, May 12, 2011 11:55 AM
    Tuesday, May 10, 2011 8:37 AM
  • Thanks, this was helpful. We needed to do some more changes to get this working though. My colleague has described the whole process in this blog post: 

    http://developeratwar.com/2011/05/get-total-number-of-hits-for-a-query-from-the-search-results-page/


    regards .r
    • Marked as answer by .r Thursday, May 12, 2011 11:55 AM
    Thursday, May 12, 2011 11:55 AM

All replies

  • This is out of scope for this forum, but you could create a web part or custom control which adds those two fields to the header of the results.aspx page. Or create your own results.aspx file with the added fields and functionality.

    Or you can edit the page template for the result page and add something like the following to the header section:

    <meta name="content" content="<%= SharedQueryManager.GetInstance(this.Page).QueryManager[0].TotalResultsIncludingDuplicates%>" />

    Regards,
    Mikael Svenson 


    Search Enthusiast - MCTS SharePoint/WCF4/ASP.Net4
    http://techmikael.blogspot.com/ - http://www.comperiosearch.com/p>
    • Proposed as answer by Thomas SvensenModerator Wednesday, May 11, 2011 7:51 PM
    • Marked as answer by .r Thursday, May 12, 2011 11:55 AM
    Tuesday, May 10, 2011 8:37 AM
  • Thanks, this was helpful. We needed to do some more changes to get this working though. My colleague has described the whole process in this blog post: 

    http://developeratwar.com/2011/05/get-total-number-of-hits-for-a-query-from-the-search-results-page/


    regards .r
    • Marked as answer by .r Thursday, May 12, 2011 11:55 AM
    Thursday, May 12, 2011 11:55 AM