Template:Browse/TileCard
More actions
Usage
Photo tile for one place on a Browse landing (Browse by growing area, Browse by growing region, Browse by country, Browse by appellation). It is the server-rendered fallback inside {{FacetBrowser}}: readers see it before MediaWiki:FacetBrowser.js loads, and keep it if the script fails or JavaScript is off. The script's tile renderer draws the same markup, so if Template:Browse/TileCard/body changes, change that renderer too.
This template counts the place's accessions once and hands everything to Template:Browse/TileCard/body, which draws the tile. Template:Browse/TileLink does the same for the plain list of the places after the first tiles.
SMW calls it from an #ask with format=template, named args=yes, mainlabel=page and link=none:
| Parameter | Printout | Shown as |
|---|---|---|
page |
the place (mainlabel) | title on the tile |
image |
?Has image=image |
the photo, drawn at 320px (480px and 640px on high-density screens); none gives the lettered placeholder |
region, province, country |
?Has growing region=region, ?Has province=province, ?Has country=country |
the line under the title: growing region (or, with none, state/province) · country for a growing area; the country for a growing region (?Has country=country); the subregion for a country (?Has subregion=region); growing area · country for an appellation (?Has growing area=region)
|
userparam |
userparam=growing area |
the kind of place (growing area, growing region, country, appellation). It names the property the accessions carry (Has growing area), the Browse subpage (Browse by growing area/…) and the placeholder's label
|
The tile links to the place's Browse subpage, as the old cards did. A place no accession names yet links its article; a subpage that does not exist yet falls back to a Special:Ask listing of its accessions (the #ifexist check also lists the missing subpage in Special:WantedPages). A place whose page records no region, province or country is placed by its accessions instead.
The page that calls it loads <templatestyles src="Browse/TileCard/styles.css" /> once, and wraps the #ask in <div class="lw-tiles">.
Calling query
<div class="lw-tiles">
{{#ask:[[Category:Growing Areas]] OR [[-Has growing area::<q>[[Category:Accessions]]</q>]]
|?Has image=image
|?Has growing region=region
|?Has province=province
|?Has country=country
|format=template
|template=Browse/TileCard
|named args=yes
|mainlabel=page
|userparam=growing area
|sort=
|limit=24
|link=none
|searchlabel=
}}
</div>