T406950: Add Wikidata and Wikimedia Commons links to work page
Summary
This PR addresses the task of displaying Wikidata and Wikimedia Commons links in the main content card of the Work detail page, mirroring the display style used on the Author page.
This change ensures users can easily navigate to the corresponding external project pages for the work item.
Key Changes
pdclasses.py:
- Implemented logic in the Work.init method to safely extract the Wikimedia Commons sitelink URL from the raw Wikidata item data (sitelinks['commonswiki']).
work.html:
-
Introduced new conditional blocks to display the Wikidata (work_wikidata_link) and Wikimedia Commons (work_commons_link) links.
-
Refactored the display style for all project links (Wikidata, Wikipedia, Commons) to remove icons and use a pipe (|) separator for a clean, compact inline list.
-
Used Jinja's whitespace control ({%- and -%}) to eliminate unwanted spacing, ensuring the pipe separator is correctly formatted with only a single space on either side.
app.py
- The work_page view function is updated to pass the two new properties, work_commons_link and work_wikidata_link, from the instantiated Work object into the template context.
How to Test
-
Navigate to a Work page that has associated links (e.g., a work with Wikidata, Wikipedia, and Commons links).
-
Verify that the section below the author names displays "Wikidata | Wikipedia | Wikimedia Commons" (or a subset thereof) with no surrounding icons and tight spacing around the pipes.
-
Ensure the links correctly point to their respective Wikimedia projects.
Here is a before image:
Here is an after image:

