Template:OWID/doc
This is a documentation subpage for Template:OWID. It contains usage information, categories and other content that is not part of the original Template page. |
Please, do not use this template. An evaluation about possible legal, privacy, security, and compliance risks related to this template is currently being conducted. For more information, please visit m:OWID Gadget. |
This template is a template gadget. It requires the OWIDPopup gadget to work, which is loaded automatically when this template is used. |
Use this template to load interactive charts from Our World in Data. The charts will only be loaded after a popup asking the user for consent to share their IP address with Our World in Data.
This template is a template gadget that requires the OWIDPopup gadget to work. Follow the installation instructions to get it working in your wiki.
Usage
[edit]Minimal
[edit]Markup | Renders as |
---|---|
{{OWID | owid = grapher/adolescent-fertility }} |
|
Full
[edit]Markup | Renders as |
---|---|
{{OWID | owid = grapher/adolescent-fertility | title = Adolescent birth rate | image = Adolescent birth rate, OWID.svg | width = 400px | float = none | caption = Adolescent birth rate according to Our World in Data. | alt = World heat map showing adolescent birth rate with a play button to make it more interactive }} |
|
Installation
[edit]To install this template in your wiki:
- Create a template with the following markup. You can choose the template name, parameter names and defaults to suit your wiki.
<includeonly><div class="OWIDPopup" style="float:{{{float|right}}}" data-owid="{{{owid}}}" data-title="{{{title|}}}">[[File:{{{image|Line chart icon Noun 70892 cc.svg}}}|thumb|{{{float|right}}}|{{{width|220px}}}|alt={{{alt|}}}|{{{caption|}}}]]</div>[[Category:Gadget:OWIDPopup]]</includeonly>
- Create MediaWiki:Gadget-OWIDPopup.js with the following code:
/** * OWIDPopup embeds interactive charts from Our World in Data * Documentation: https://www.mediawiki.org/wiki/Template:OWIDPopup * Source code: https://www.mediawiki.org/wiki/MediaWiki:Gadget-Global-OWIDPopup.js */ mw.loader.load( '//www.mediawiki.org/w/load.php?modules=ext.gadget.Global-OWIDPopup' );
- Add the following gadget to MediaWiki:Gadgets-definition:
* OWIDPopup[ResourceLoader|hidden|default|categories=Gadget:OWIDPopup]|OWIDPopup.js
Done! Add your template to any page to verify that the installation was successful.
Categorization
[edit]All the articles will be included in a category called OWIDPopup.js. You can create that category and use it for tracking.
Template data
[edit]Use this template to insert interactive charts from Our World in Data.
Parameter | Description | Type | Status | |
---|---|---|---|---|
OWID | owid | Identifier of the chart to embed from Our World in Data
| String | optional |
Title | title | Title of the chart
| String | optional |
Image | image | Name of the image
| String | optional |
Float | float | Position of the image
| String | optional |
Width | width | Width of the image
| String | optional |
Alternative text | alt | Alternative text for the image | String | optional |
Caption | caption | Caption of the image
| String | optional |
See also
[edit]- MediaWiki:Gadget-Global-OWIDPopup.js - JavaScript of this template
- MediaWiki:Gadget-Global-OWIDPopup.css - CSS of this template
- MDWiki - More examples