Extension:Radyjonka
Radyjonka Release status: beta |
|
---|---|
Implementation | User interface |
Description | Provides a basic support for creating a progressive web app (PWA) from the MediaWiki instance. It also allows to insert some content to the HTML head (linked data etc.). |
Author(s) | Petr Kajzar |
Latest version | 0.4.0 (2019-09-27) |
Compatibility policy | Master maintains backward compatibility. |
MediaWiki | 1.29+ |
License | Creative Commons Zero v1.0 Universal |
Download | Download master snapshot Note: README |
The Radyjonka MediaWiki extension provides a very basic support for creating a progressive web app (PWA) from the MediaWiki instance. It also allows to insert some content to the HTML head (linked data etc.). It is developed mainly for the purposes of WikiSkripta wiki project.
Installation
edit- Download and place the file(s) in a directory called
Radyjonka
in yourextensions/
folder. - Add the following code at the bottom of your LocalSettings.php file:
wfLoadExtension( 'Radyjonka' );
- Done – Navigate to Special:Version on your wiki to verify that the extension is successfully installed.
Usage
editConfiguration for linked data
editIf you want to add some linked data to your site (probably because of improving your site's search results), just add an associative array to your LocalSettings.php
:
$wgRadyjonkaLinkedData = [
"@context" => "https://schema.org",
"@type" => "WebSite",
"url" => "https://www.mymediawikiaddress.com/",
"potentialAction" => [
"@type" => "SearchAction",
"target" => "https://www.mymediawikiaddress.com/index.php?search={search_term_string}",
"query-input" => "required name=search_term_string"
]
];
This associative array will be translated into reasonable JSON and inserted to the HTML head of your wiki.
For more inspiration how to use linked data for improving search results please visit: https://developers.google.com/search/docs/data-types/article
Configuration for PWA
editProgressive web apps (PWAs) are websites that provide some offline content for the user and can be installed on desktops or mobile phones and feel like native apps of the device. Read more about PWA.
To enable progressive web app on your wiki, just insert this piece of code to your LocalSettings.php
:
$wgRadyjonkaPWA = true;
Then you'll need to meet some criteria:
- You have to write your own web app's
manifest.json
and place it in the root directory of your wiki. Read documentation or visit WikiSkripta's manifest for inspiration. - You'll need two PNG icons, 192x192 px and 512x512 px (see manifest.json).
- You'll need some offline landing page that says something like: "You're offline now, please return to the home page."
- You'll need a javascript service worker named
sw.js
in your root directory of the wiki (i.e. where theLocalSettings.php
file is stored). That service worker file declares, what is the behavior of the website when online and when offline. You can pre-cache some pages, you can cache pages on demand (like let user click on "Read later" button) or cache visited articles automatically. You can even make your wiki editable when the user is offline (and edits will be sent after reconnecting the network). This is unfortunately part of the work that you have to write yourself according to your needs. It is not included in the extension. For documentation on service workers please visit Google Developers. For inspiration check the detailed and explainedsw-example.js
file in the extension's repository. Please note that it is probably not possible to make a MediaWiki instance completely offline-enabled, this is only to provide some basic support to read visited texts offline. - Your site has to be served over a secure and valid HTTPS connection. Make sure that your HTTP version correctly redirects to HTTPS.
License
editCreated at 1st Faculty of Medicine, Charles Univesity, for WikiSkripta medical wiki. Released under Creative Commons Zero v1.0 Universal license.
This software is distributed without any warranty.
See also
edit- Extension:PWA: a more advanced PWA extension