Tech Support Posted February 25, 2022 Share Posted February 25, 2022 List of search queries is displayed by search_results block. Here is how you can put it into the main pages: {{insert name="getBlock" block_id="search_results" block_name="Similar Searches"}} Put it into Index and Common Videos List (renders categories, tags, models, content sources and etc.) page templates. After you add this block into page template and save, it will appear in the list of blocks on this page and you can edit its settings. Here is template code for this block that will render cloud of search queries: {{if count($data)>0}} <div class="box search-cloud"> {{foreach item="item" from=$data}} {{assign var="query" value=$item.query|replace:"-":"[dash]"|replace:"&":"%26"|replace:"?":"%3F"|replace:"/":"%2F"|replace:" ":"-"|replace:"[dash]":"--"|rawurlencode}} <a href="{{$lang.urls.search_query|replace:"%QUERY%":$query}}" style="{{if $item.is_bold==1}}font-weight: bold; {{/if}}{{if $item.size>0}}font-size: {{$item.size}}px;{{/if}}">{{$item.query}}</a> {{/foreach}} </div> {{/if}} In block parameters configure: items_per_page: the number of queries you want to be displayed. sort_by: sorting of the queries. var_category_dir = category var_tag_dir = tag size_from = 12 size_to = 16 Also make sure you put a cache time of 86400, as this block will be quite heavy. When this is configured, you can see query cloud is displayed on Index and other video pages. For tag and category pages it should be relevant to the displayed tag / category. On other pages it may render the same set of queries, as they won't have context object that can be used to display similar queries. Quote Link to comment Share on other sites More sharing options...
xApster Posted March 29, 2022 Share Posted March 29, 2022 Is there a way to use the related search queries on a video page? Giving suggested results based on the video title. Quote Link to comment Share on other sites More sharing options...
Tech Support Posted March 30, 2022 Author Share Posted March 30, 2022 Yes, possible, but only if you pass video directory in the URL. If your video URLs only have ID in them, not possible. You can add search_results block to a video page and configure its var_query parameter to dir value: var_query = dir This should result in showing queries similar to what is in video title passed in the URL. Please make sure to put at least 86400 caching time for this block, as it will produce high load on DB and caching would be very important here. Quote Link to comment Share on other sites More sharing options...
Jim Posted January 15 Share Posted January 15 On 2/24/2022 at 11:11 PM, Tech Support said: List of search queries is displayed by search_results block. Here is how you can put it into the main pages: {{insert name="getBlock" block_id="search_results" block_name="Similar Searches"}} Put it into Index and Common Videos List (renders categories, tags, models, content sources and etc.) page templates. After you add this block into page template and save, it will appear in the list of blocks on this page and you can edit its settings. Here is template code for this block that will render cloud of search queries: {{if count($data)>0}} <div class="box search-cloud"> {{foreach item="item" from=$data}} {{assign var="query" value=$item.query|replace:"-":"[dash]"|replace:"&":"%26"|replace:"?":"%3F"|replace:"/":"%2F"|replace:" ":"-"|replace:"[dash]":"--"|rawurlencode}} <a href="{{$lang.urls.search_query|replace:"%QUERY%":$query}}" style="{{if $item.is_bold==1}}font-weight: bold; {{/if}}{{if $item.size>0}}font-size: {{$item.size}}px;{{/if}}">{{$item.query}}</a> {{/foreach}} </div> {{/if}} In block parameters configure: items_per_page: the number of queries you want to be displayed. sort_by: sorting of the queries. var_category_dir = category var_tag_dir = tag size_from = 12 size_to = 16 Also make sure you put a cache time of 86400, as this block will be quite heavy. When this is configured, you can see query cloud is displayed on Index and other video pages. For tag and category pages it should be relevant to the displayed tag / category. On other pages it may render the same set of queries, as they won't have context object that can be used to display similar queries. Please could you provide some screenshots/further description to show how this would look? Thanks. Quote Link to comment Share on other sites More sharing options...
Tech Support Posted January 16 Author Share Posted January 16 You can see it here on the top of page: https://www.kvs-demo.com/search/lady/ Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.