Extension:LinkCards

From mediawiki.org
Jump to navigation Jump to search
MediaWiki extensions manual
OOjs UI icon advanced-invert.svg
LinkCards
Release status: experimental
Implementation Parser function
Author(s) (Samwilsontalk)
Latest version 0.3.0 (2021-10-03)
MediaWiki
Database changes No
Composer wikimedia-au/link-cards
License GNU General Public License 3.0 or later
Download

Check usage and version matrix.

The LinkCards extension adds two parser functions for the easy display of grids of clickable image-and-title 'cards'. Cards are graphical layout components that have an image, title, and some body text. Their entire area is a clickable link. The name comes from Bootstrap's version of this idea, from which we're borrowing.

Cards can be displayed singularly, or with multiple on one line. On small screens they are reduced to either full width (for a single card or more than two) or two cards side-by-side (if there are only two).

The images in cards are always the same height, so that the card titles always line up horizontally. This means that images will be cropped if their aspect ratio is not correct.

This extension doesn't really do anything that's not also possible via on-wiki templates and styles, it's just easier to deploy to multiple wikis.

Installation[edit]

  • Download and place the file(s) in a directory called LinkCards in your extensions/ folder.
  • Add the following code at the bottom of your LocalSettings.php:
    wfLoadExtension( 'LinkCards' );
    
  • Yes Done – Navigate to Special:Version on your wiki to verify that the extension is successfully installed.

Usage[edit]

A single card:

{{#linkcard:Link|title=Lorem Ipsum|body=Lorem ipsum sic non muelo sarcinam portat.}}

Multiple cards on one line:

{{#linkcards:

 | link1  = Link One
 | title1 = Title One
 | body1  = Body one.
 | image1 = Example.png

 | link2  = Link One
 | title2 = Title One
 | body2  = Body one.
 | image2 = Example2.png

}}