The forum of the forums
Would you like to react to this message? Create an account in a few clicks or log in to continue.

Use Google as a search tool inside the Forum

3 posters

Go down

Use Google as a search tool inside the Forum  Empty Use Google as a search tool inside the Forum

Post by admin of driving rules ZH January 17th 2022, 10:37 am

I recently got the search function working. But the google search tool inside the forum gives no results when searching for words found on the forum. I would like google search to work on the forum. Please Note: This is not about the forum appearing on google. Only filter results posted on the forum. In the search field, it should say site: xxxx.forumotion.eu together with keywords.
admin of driving rules ZH
admin of driving rules ZH
New Member

Posts : 10
Reputation : 1
Language : English, German, Swedish

https://zhrules.forumotion.eu/

Back to top Go down

Use Google as a search tool inside the Forum  Empty Re: Use Google as a search tool inside the Forum

Post by Jucarese January 17th 2022, 11:29 am

You can create a custom search engine for your forum from here:
https://programmablesearchngine.google.com/about/
Once the engine is created by filling in the data that asks you, you must press on obtaining code
It will give you a code <script> copy and sticker in a notepad
then you must create a new javascript for your forum in this way:
Important You must have a Gmail account to be able to do this.


Code:

$(function () {

 //Here goes the saved code line of the previous step since var cx what goes From = up to "
 var cx = your code";
 

if($("div#search-box").length){
//phpbb3 with search engine
 $("div#search-box").html("<div id='my_gs'><gcse:search></gcse:search></div>");
 }else{
 if($("div#page-body").length){
 //phpbb2, phpBB3 No search engine and Punbb
 $("<div id='my_gs'><gcse:search></gcse:search></div>").insertBefore("div#page-body");
 }else{
 //Invision
 $("<div id='my_gs'><gcse:search></gcse:search></div>").insertAfter("div#submenu");
 }
 }
 
var gcse = document.createElement('script');
 gcse.type = 'text/javascript';
 gcse.async = true;
 gcse.src = (document.location.protocol == 'https:' ? 'https:' : 'http:') +
 '//www.google.com/cse/cse.js?cx=' + cx;
 var s = document.getElementsByTagName('script')[0];
 s.parentNode.insertBefore(gcse, s);
});

You can customize it with CSS



Code:

.my_gs{
   /* CSS properties here (here is not necessary the !important) */
}

div#my_gs {
    width: 300px; /* If the bar comes out very long in Chrome */
}

Or the search box where writing:



Code:

input.gsc-input{
   /* CSS properties here (with !important) */
}


Or the search button:



Code:

input.gsc-search-button{
   /* CSS properties here (with !important) */
}


But the simplest and most practical thing is to do it from the Google page,  you can customize by clicking on your new search engine created, and adding the keywords design and more things from the menu you have to the left of the page.This new engine what you do is look for any word you have in your forum, and that this is indexed on Google, for this, of course you must have your forum indexed correctly.
Jucarese
Jucarese
Hyperactive

Male Posts : 2552
Reputation : 120
Language : spanish
Location : SSF Admin

http://asistencia.foroactivo.com/u23082

skouliki and Niko like this post

Back to top Go down

Use Google as a search tool inside the Forum  Empty Re: Use Google as a search tool inside the Forum

Post by SLGray January 17th 2022, 6:10 pm

The default search engine on our forums is not a Google search.  So did you add the Google search?


Use Google as a search tool inside the Forum  Slgray10

When your topic has been solved, ensure you mark the topic solved.
Never post your email in public.
SLGray
SLGray
Administrator
Administrator

Male Posts : 51554
Reputation : 3524
Language : English
Location : United States

https://forumsclub.com/gc/128-link-directory/

Back to top Go down

Use Google as a search tool inside the Forum  Empty Re: Use Google as a search tool inside the Forum

Post by admin of driving rules ZH January 17th 2022, 6:21 pm

SLGray wrote:The default search engine on our forums is not a Google search.  So did you add the Google search?
Exactly.

But jucarese explanation was hard to understand for me who does not have programming skills. I managed to get the code on google via the gmail address. I can not get any further than that.
admin of driving rules ZH
admin of driving rules ZH
New Member

Posts : 10
Reputation : 1
Language : English, German, Swedish

https://zhrules.forumotion.eu/

Back to top Go down

Use Google as a search tool inside the Forum  Empty Re: Use Google as a search tool inside the Forum

Post by SLGray January 17th 2022, 6:31 pm

JavaScript:

AP > Modules > JavaScript/HTML > JavaScript Management


Use Google as a search tool inside the Forum  Slgray10

When your topic has been solved, ensure you mark the topic solved.
Never post your email in public.
SLGray
SLGray
Administrator
Administrator

Male Posts : 51554
Reputation : 3524
Language : English
Location : United States

https://forumsclub.com/gc/128-link-directory/

Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum