Extension:GoogleSiteSearch
Jump to navigation
Jump to search
![]() | This extension is currently not actively maintained! Although it may still work, any bug reports or feature requests will more than likely be ignored. If you are interested in taking on the task of developing and maintaining this extension, you can request repository ownership. As a courtesy, you may want to contact the author. You should also remove this template and list yourself as maintaining the extension in the page's {{extension}} infobox. |
GoogleSiteSearch Release status: unmaintained |
|
---|---|
Implementation | Search |
Description | Adds to or replaces MW Special:Search results with Google CSE results |
Author(s) | Ryan Finnie (Fo0bartalk) |
Latest version | 3.0 (2019-12-01) |
MediaWiki | 1.32+ |
PHP | 7.0+ |
License | GNU General Public License 2.0 or later |
Download | |
Example | finnix.org search result |
|
|
Translate the GoogleSiteSearch extension if it is available at translatewiki.net | |
The GoogleSiteSearch extension allows you to add Google Custom Search Engine (CSE) results to "Special:Search" additionally to MediaWiki search results, or optionally, replace them altogether.
Installation[edit]
- Go to the Google CSE management page and add a custom search engine. Note down the "Search engine unique ID". It should be in the format
numbers:letters
. - Download and place the file(s) in a directory called
GoogleSiteSearch
in yourextensions/
folder. - Add the following code at the bottom of your LocalSettings.php:
wfLoadExtension( 'GoogleSiteSearch' ); $wgGoogleSiteSearchCSEID = 'YOUR_CSE_ID';
- Configure as required.
Done – Navigate to Special:Version on your wiki to verify that the extension is successfully installed.
Configuration[edit]
The following configuration paramters are available:
$wgGoogleSiteSearchCSEID
- The ID of the created Google custom search engine. Required.
$wgGoogleSiteSearchOnly
- Whether to replace the the MediaWiki search results. If
true
, only the CSE search results are shown. If false, the CSE results are shown above the MediaWiki results. Optional, defaults tofalse
. $wgGoogleSiteSearchAttributes
- An array of optional Custom Search element attributes. For example, to make links open in a new window/tab:
$wgGoogleSiteSearchAttributes = [ 'linkTarget' => '_blank' ];
In addition, the HTML built by the extension is customizable via the "GoogleSiteSearchHTML" hook. For example:
function MyGSSHTML( $specialSearch, $term, &$html ) {
$html .= '<p>Example append</p>';
}
$wgHooks['GoogleSiteSearchHTML'][] = 'MyGSSHTML';
See also[edit]
- Extension:GoogleCustomWikiSearch - offers similar functionality