The Free Knowledge Portal is a tool by Evad37 that is a solution to the Wikimedia 2017 Community Wishlist Survey proposal "Qr codes for all items".
The existing QR-encoding tool, QRpedia, allows GLAM instituations, other organisations, or anyone else create a QR code for a Wikipedia article. The QR code is generated based on the article title in a specific primary language. These QR codes can be placed in a relevant physical location, printed on handouts, or otherwise made available so that members of the public can scan them, and get more information from the Wikipedia article.
The problems, per the wishlist proposal, include:
- Articles can be renamed, breaking the links (e.g. "Foo" is renamed to "Foo (disambiguated)").
- Only Wikipedia articles can be accessed from the QR codes, despite the wealth of relevant information that might be available in sister projects like Wikivoyage and Wikisource.
- QR codes for non-Latin languages are very large and more difficult to use (example)
The solution to all those problems is to use Wikidata:
- Wikidata item ids are stable, and don't change when pages are moved. If Wikidata items are merged into another item, a redirect is left behind which can be followed.
- Wikidata item ids store site links to Wikimedia projects. These can be presented to end-users as a portal, so they can choose which of the available wikis to go to, rather than just Wikipedia
- The length of the url encoded in the QR code is determined by the Wikidata item id, not the page title, so you don't need huge QR codes for non-Latin languages.
The Free Knowledge Portal is a tool (hosted on Wikimedia's Toolforge) that provides this solution.
- Since links are displayed in a portal page, rather than just redirected to Wikipedia, the portal can also show:
- Related items (items that link to the subject item)
- Nearby items (for items which have coordinates specified)
- External identifiers (such as those for GLAM partner institutions)
- Responsive design that adapts to mobile, tablet, and desktop views
- Language switcher that not only translates the interface, but also changes the site links to that language version of the site (e.g. French Wikipedia when the language selected is French)
- Automatically detects device language, and uses that language by default
- Backwards-compatible with existing QRpedia codes, by using a page title and site to determine the relevant Wikidata item id. (But of course its up to the QRpedia people to redirect the codes to these urls if they choose to)
- Boston (Q100), using your device's language: https://tools.wmflabs.org/portal/Q100
- Boston (Q100), using French: https://tools.wmflabs.org/portal/Q100/fr
- Boston (Q100), using Spanish: https://tools.wmflabs.org/portal/Q100/es
- Backwards-compatible url for Boston on English Wikipedia: https://tools.wmflabs.org/portal/?title=Boston&site=enwiki
- To generate a QR code, go to https://tools.wmflabs.org/portal and enter a Wikidata item id.
This tool supports internationalisation.
- Content: Item labels, descriptions, and sitelinks are retrieved from Wikidata in the specified langauge. Any updates need to be made on Wikidata.
- Interface: Translations for strings used in the interface are located in JSON files in the /i18n directory. To add another langauge:
- Create a new JSON file, using the same format as the existing files
- Save it as
- Add the langauge code and name to the
/i18n/_langs.jsonfile (sorted in alphabetical order by langauge code)
This tool is located on the Wikimedia Toolforge, at https://tools.wmflabs.org/portal/. To update:
- Login to toolforge with ssh:
ssh -i ~/.ssh/id_rsa firstname.lastname@example.org
- Become the tool account:
- Pull from GitHub repo into the
- If the
.lighttpd.conffile has changed, that file needs to be copied to the root directory:
cp public_html/.lighttpd.conf .lighttpd.conf
- ...then restart the webservice:
Page views are stored in an SQL database. To connect manually:
- Login to toolforge with ssh, become the tool account (as above)
- Retreive database username:
- Connect with mysql:
mysql --defaults-file=$HOME/replica.my.cnf -h tools.db.svc.eqiad.wmflabs USER__views