Jump to content

View it! Tool

From Meta, a Wikimedia project coordination wiki

View it!

View it! is a suite of tools that display all relevant media from Wikimedia Commons depicting—or otherwise related to—the article one is reading. It officially launched on January 12, 2023 with a web app, two user scripts, and an API.

Coolest Tool Award 2024 logo
View It!

2024 Coolest Tool
Award Winner

in the category
Newcomer

Description

[edit]
View it! gallery on a Wikipedia article

View it! is a suite of tools to help editors and readers discover freely licensed media, enabled by structured data on Commons. While the number of images displayed in a Wikipedia article is finite and highly curated by editors, View it! allows readers to easily access the full catalog of images available on Wikimedia Commons, and help editors easily add relevant media to an article.

The Toolforge source code is published here and we have a changelog available of all tool and script changes.

View it! Suite

Search Portal
for querying images by Q-item

User script
for embedding galleries on articles

API
for building your own tools

Features

[edit]

View it! provides two experiences to explore and view media via structured data on Commons:

When using the user scripts, users are able to easily add an image to an article they are editing. While in either visual or source editor, users can copy the image wikitext code by clicking the copy icon on any image in the gallery and paste it into the article they're working on. When using View it! on Wikidata, users can also easily assign an image as an item's image (P18) statement if one doesn't already exist.

View it! copy function, 2024

Script installation

[edit]

View it! user script comes in two flavors: full and lite.

  • The full version of View it! embeds a gallery at the top of articles so that images are readily and easily viewable. It includes the ability to copy image wikitext code, and allows users to add image (P18) statements on Wikidata items in one-click.
  • The lite version of View it! adds a "View" tab to Wikimedia articles, allowing users to switch to a gallery view.

Across projects

[edit]

To enable View it! on all Wikimedia wikis:

  1. Visit your global.js page on Meta: User:<YourUserName>/global.js
  2. Copy in the code
    • For full View it!: {{subst:view it}}
    • For lite View it!: {{subst:view it/lite}}
  3. Click "Publish changes"

Please note you may see an error message reading: The document contains errors. Are you sure you want to publish? when you click publish - this is a bug, and it will still work.

For specific projects

[edit]

If you wish to only enable View it! on your local project:

  1. Visit your common.js page: "Special:MyPage/common.js" on your wiki of choice.
  2. Copy in the code
    • For full View it!:
      mw.loader.load( '//meta.wikimedia.org/w/index.php?title=User:SuperHamster/view-it-full.js&action=raw&ctype=text/javascript' ); // Backlink: [[meta:User:SuperHamster/view-it-full.js]]
    • For View it! lite:
      mw.loader.load( '//meta.wikimedia.org/w/index.php?title=User:SuperHamster/view-it.js&action=raw&ctype=text/javascript' ); // Backlink: [[meta:User:SuperHamster/view-it.js]]
  3. Click "Publish changes"

After installation

[edit]

Once installed you will see a "View" button between "Read" and "Edit" on the right that is connected to Wikidata/Structured data. The gallery will show 20 images at a time that can be scrolled through (left to right). When the 4 blue, downward facing arrows are clicked, users are shown all 20 images at one time. If there are more than 20 images, a previous page and next page button will appear, so all images may be paged through. Additionally, there is a button sayng "View all x images" with the number of images available.

View it! will also work on other Wikipedia projects:

Localization

[edit]

View it! has multilingual support! Add missing languages by expanding the localization instructions below. You can also make edits to existing languages.

Expand for localization instructions

Steps

[edit]

Please note that to prevent mistakes or abuse, changes are not automatic. Let us know if you've made an update that still needs to be deployed.

To help us make View it! multilingual:

  1. Visit View it! Tool/localization.json
  2. To make a change/correction to an existing language, simply edit the fields for that language's entry. You might want to discuss your change if someone else preferred a different wording.
  3. For a new language, copy the existing JSON notation for a language entry, for example:
    "en": {
    "label": "View",
    "description": "View images related to this article"
    "open": "Open",
    "close": "Close"
    "previous": "Previous Page",
    "next": "Next Page"
    },
  4. Follow these guidelines when adding/updating languages in the JSON:
    • Specify the language using its language code at the top of the entry (e.g. "en" for English, "es" for Spanish, etc.)
    • "label" and "description" can be changed to any value, per your local language community's preference. It does not need to be a translation of the English.
      • The "label" value controls what text goes in the tab. (Currently "View" in English.)
      • The "description" value controls the helpful tooltip that appears if a user hovers over the tab.
    • Languages should appear in Latin alphabetical order. Do not just place a new language at the top or bottom unless that is where it goes alphabetically.
    • If the new language you are adding is at the end, for valid JSON syntax, you must ensure the comma format is preserved. That is, add a final comma to the previous final language entry, and do not include a final comma (unlike the example code above) for the new language you are adding. (Ending list items in JSON arrays do not have commas.)
  5. Hit "Publish changes", and we'll update our script with your translations soon!

Example

[edit]
View it! Tool localization.json page
Editing screen for View it! Tool localization.json
Translation (Swedish) added to View it! Tool localization.json
View it! Tool localization.json after saving new translation

API

[edit]

View it! also includes its own API that serves as an intermediary service in front of the standard Commons Structure Data API, to simplify querying.

To query for images for a particular Wikidata item, like Q2 for Earth:

https://view-it.toolforge.org/api/Q2

Each response includes the total image count, and an array of up to 20 image results that include a link to the file page, a thumbnail, the file title, and then width and height of the thumbnail.

To retrieve images beyond the initial 20 results, you can use the offset parameter:

https://view-it.toolforge.org/api/Q2?offset=20

By default, View it! will search for images that "depict or link from" the specified Q-item. You can choose to search against other Wikidata properties: Depicts (P180), Main subject (P921), Created by (P170), or Commons category (P373).

https://view-it.toolforge.org/api/Q2?property=depicts
https://view-it.toolforge.org/api/Q2?property=main
https://view-it.toolforge.org/api/Q2?property=creator
https://view-it.toolforge.org/api/Q2?property=category

To filter by assessment (featured, quality, valued):

https://view-it.toolforge.org/api/Q2?assessment=featured

To filter by resolution (small [<500px], medium, large [>1000px]):

https://view-it.toolforge.org/api/Q2?resolution=high

To search with free text:

https://view-it.toolforge.org/api/Q2?freetext=text

Update sign up

[edit]

Update archive

Please sign up if you're interested in receiving periodic updates about View it! tool - including the launch date and listening/comment sessions.


Status

[edit]

August 2022

[edit]

The team is investigating community wishes and best technical approaches.

View it! tool presentation at Wikimania 2022/Pittsburgh Meetup
Presentation recording from the August 31st meeting
  • Wednesday, August 31, 2022 16:00 UTC: A virtual presentation and discussion was held during the Wikimedians in Residence Exchange Network monthly meeting, with anyone is welcome to attend.
  • Saturday, August 13, 2022: In-person presentation/listening session, "Discoverability, Structured Data & the View it! tool" at Carnegie Library, East Liberty, Meeting Room 3. 130 S. Whitfield Street Pittsburgh, PA 15206 (second floor, handicap accessible).

September 2022

[edit]

The development team is currently working to make the tool multilingual. Please help us with localization!

October 2022

[edit]
  • View it! now has a Common's category search in the Advanced search function on Toolforge.
  • View it! is available across all Wikimedia namespaces, including Wikisource author and index pages.
  • View it! has been installed by 97 users; and has been translated into 14 languages.

November/December 2022

[edit]
  • View it! had been re-envisioned into two versions - full and lite.
  • The full version now includes an image carousel on each content page which can be expanded for pagniation.
  • You can also look at a full-screen gallery by clicking the "View" tab.

Usage

[edit]
  • As of August 2024, 170 users have installed View it! across global, Commons, and various language specific projects.
  • View it! has also been modified and added to other projects and utilized in other search queries:

Timeline

[edit]

The project was funded for development by the Wikimedia Foundation's Structured Data Across Wikimedia project, and has a 6 month timeline. View it! will be completed by January 2023.

Team

[edit]

To share opinions, wishes, or ask questions please leave a message on the talk page. If you wish to reach a team member directly, please feel free to leave a message on our respective talk pages:

Beta testers

[edit]

Testing announcement archive

Thank you to those who participated in Beta testing and provided valuable feedback for View it!:

View it! tool Beta testing sign ups.

Update Sign up

[edit]

List of those interested in View it! Tool/Update sign up:

JWheeler-WMF