Extension:GoogleKnowledgeGraph
Appearance
Release status: beta |
|
|---|---|
| Implementation | Tag, API |
| Description | The GoogleKnowledgeGraph extension automatically gets short summary from Google Knowledge Graph and adds it to a tooltip. |
| Author(s) | Urfiner (Nikolai Kochkin) |
| Latest version | 0.1.0 |
| MediaWiki | 1.43 |
| License | MIT License |
| Download | GitHub:
Note: |
The GoogleKnowledgeGraph extension automatically gets short summary from Google Knowledge Graph and adds it to a tooltip.
The extension developed to help newcommers understand how to create a simple extension with frontend/backend (parser+api). The code of the extension is well-commented to make it easy to understand.
Production usage of the extension is not recommended.
Installation
[edit]- Download and place the file(s) in a directory called
GoogleKnowledgeGraphin yourextensions/folder. - Add the following code at the bottom of your LocalSettings.php file:
wfLoadExtension( 'GoogleKnowledgeGraph' );
- Configure API key:
- Get Google API token here
- In LocalSettings.php set your key:
$wgGoogleApiToken = 'your-google-token';
- Setup language:
$wgGoogleApiLanguage = 'en';
Done – Navigate to Special:Version on your wiki to verify that the extension is successfully installed.
Usage
[edit]Put something like that on your page:
<GoogleKnowledgeGraph query="Mario"/>
And save the page. After that hover cursor on the word "Mario" and see:
Production usage disclamer
[edit]The extension is not recommended for production usage:
- Google Knowledge Graph provides only 100 000 requests for free per day.
- For small wikis it is more than enough but on big ones the limit will be depleted quite soon.
- Howewer, adding long-living cache may significantly improve the situation if for some reason you still want to use it in prod. There is a comment in code how a simple caching can be added.
- It is not a big issue for English but Google Knowledge Graph supports search terms in Nominative case only.
- In the future we can add something like that (synthax is not supported yet):
<GoogleKnowledgeGraph query="Mario">visible text</GoogleKnowledgeGraph>.
- In the future we can add something like that (synthax is not supported yet):

