Go Back   vb.org Archive > vBulletin Modifications > vBulletin 5.x Modifications > vBulletin 5.x Template Modifications
[vBMods.rocks] Add Search Engine Search Result link on vB5 Search Result page Details »»
[vBMods.rocks] Add Search Engine Search Result link on vB5 Search Result page
Version: 1.00, by noypiscripter noypiscripter is offline
Developer Last Online: Sep 2023 Show Printable Version Email this Page

Category: Miscellaneous Hacks - Version: 5.5.5 Rating:
Released: 02-28-2022 Last Update: Never Installs: 1
Supported Template Edits
 

In some cases, the vB5 search results may not provide you what you're searching for in a forum. You could replace the default vB5 Search box with the Google Search box or add a Google search result link (and other search engines) together with the vB5 search results. These search engine links will redirect the user to their search results for your site.

If you are more interested in the latter, then continue reading.

Before giving you the code to accomplish what is shown in the above screenshot, let me give you first the limitations/disadvantages of doing this modification:
  1. Your site must be public as search engines cannot index private pages.
  2. Your site will lose branding to search engines as users are taken out of your site and redirected to search engine search results page.
  3. Recent content from your forum may not be instantly available until search engines index your site.
  4. This mod requires editing the Search Results template which means the changes may cause template conflicts during upgrades.
  5. Since this requires template editing, this is not for vBCloud although there is another solution to implement it that will work on vBCloud.
If you are okay with the above, then proceed with these steps:
  1. Logon to AdminCP.
  2. Go to Styles → Search in Templates
  3. Choose the target style/theme in the "Search in Style" dropdown.
  4. In the "Search for Text" field, type widget_search_results.
  5. Select "Yes" in the "Search Titles Only" radio button.
  6. Click Find button.
  7. In the search results, double-click the template to edit it or select it then click Customize button.
  8. Find the following code (Click the Template input box and press Ctrl+F or Command+F)
    Code:
    <vb:if condition="!empty($nodes['ignored_keywords'])">
  9. Find its closing </vb:if> tag
  10. Below that code, insert the following code:
    Code:
    <vb:if condition="!empty($searchJSONStructure['keywords'])">
    	<p class="alternative-search-engine-search h-margin-top-l">
    	Can't find what you're looking for? See <a href="https://www.google.com/search?q={vb:urlencode {vb:raw searchJSONStructure.keywords}}+site%3A{vb:urlencode {vb:raw baseurl}}" target="_blank"><strong>Google</strong></a> search results for '{vb:raw searchJSONStructure.keywords}'.
    	</p>
    	</vb:if>
    That adds a Google search results link using the "site:" filter on search engines that search within the specified site URL which is your forum URL in this case. To add other search engine links, include the following hyperlink HTML:

    DuckDuckGo:
    HTML Code:
    <a href="https://duckduckgo.com/?q={vb:urlencode {vb:raw searchJSONStructure.keywords}}+site%3A{vb:urlencode {vb:raw baseurl}}" target="_blank"><strong>DuckDuckGo</strong></a>
    Bing:
    HTML Code:
    <a href="https://www.bing.com/search?q={vb:urlencode {vb:raw searchJSONStructure.keywords}}%20site%3A{vb:urlencode {vb:raw baseurl}}" target="_blank"><strong>Bing</strong></a>
    Yahoo:
    HTML Code:
    <a href="https://search.yahoo.com/search?p={vb:urlencode {vb:raw searchJSONStructure.keywords}}+site%3A{vb:urlencode {vb:raw baseurl}}" target="_blank"><strong>Yahoo</strong></a>
    Yandex:
    HTML Code:
    <a href="https://yandex.com/search/?text={vb:urlencode {vb:raw searchJSONStructure.keywords}}+site%3A{vb:urlencode {vb:raw baseurl}}" target="_blank"><strong>Yandex</strong></a>
    For example, on my forum, I added Google and DuckDuckGo. Here's the code I used:
    Code:
    <vb:if condition="!empty($searchJSONStructure['keywords'])">
    	<p class="alternative-search-engine-search h-margin-top-l">
    	Can't find what you're looking for? See <a href="https://www.google.com/search?q={vb:urlencode {vb:raw searchJSONStructure.keywords}}+site%3A{vb:urlencode {vb:raw baseurl}}" target="_blank"><strong>Google</strong></a> or <a href="https://duckduckgo.com/?q={vb:urlencode {vb:raw searchJSONStructure.keywords}}+site%3A{vb:urlencode {vb:raw baseurl}}" target="_blank"><strong>DuckDuckGo</strong></a> search results for '{vb:raw searchJSONStructure.keywords}'.
    	</p>
    	</vb:if>
  11. Click Save button.
  12. Repeat Steps 2-11 for other active styles/themes on your forum (if any).
Demo:
Try searching on my forum or clicking this search result:

https://vbmods.rocks/search?q=IP&sea...%3A%22IP%22%7D


Enjoy!

Screenshots

File Type: png search-results.png (55.0 KB, 0 views)

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.
2 благодарности(ей) от:
TheLastSuperman, tuerkraider
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 08:58 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.03605 seconds
  • Memory Usage 2,217KB
  • Queries Executed 15 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (3)bbcode_code
  • (4)bbcode_html
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (4)navbar_link
  • (120)option
  • (1)post_thanks_box
  • (2)post_thanks_box_bit
  • (1)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit
  • (1)post_thanks_postbit_info
  • (1)postbit_attachment
  • (1)postbit_onlinestatus
  • (1)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • fetch_musername
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • post_thanks_function_fetch_thanks_bit_start
  • post_thanks_function_show_thanks_date_start
  • post_thanks_function_show_thanks_date_end
  • post_thanks_function_fetch_thanks_bit_end
  • post_thanks_function_fetch_post_thanks_template_start
  • post_thanks_function_fetch_post_thanks_template_end
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_attachment
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete