Template:Browse/CountryCard
More actions
Usage
Card template fed by SMW format=template queries on the Browse by country page. Renders one card per country that at least one accession names in Has country.
Receives two positional parameters from SMW:
{{{1}}}— country page name (mainlabel){{{2}}}— bare image filename from?Has image=imageprintout. Empty if no image set.
Card click target is the country browse subpage at Browse by country/{Country}, not the main country article. The browse subpage shows the accession listing and links back to the main article from its own lead when that article exists.
If the subpage has not been created yet, the card falls back to a Special:Ask listing of that country's accessions, so a country that arrives with a new accession batch never leads to an edit form. The #ifexist check also records the missing subpage in Special:WantedPages. To fill the gap, create Browse by country/{Country} containing {{Browse/CountrySubpage|country={Country}}}.
The count label uses PLURAL, so a country with one record reads "1 accession".
Outer #ask query needs link=none so values arrive as bare text rather than wikilink-formatted strings.
The overlay link text is the country name. CSS hides it visually; screen readers announce it.
Image is requested at 1024px width for retina sharpness; CSS scales it to fill the 16:10 container via object-fit: cover. The image comes from the country article's Has image, which {{Infobox Country}} sets. Cards for countries without an article, or whose article has no infobox image, show the placeholder colour.
Template wikitext is on a single line by design.
Calling query
The query takes the inverse of Has country over the accessions, so the grid lists exactly the countries that have records, whether or not the country article exists yet.
{{#ask:[[-Has country::<q>[[Category:Accessions]]</q>]]
|?Has image=image
|format=template
|template=Browse/CountryCard
|sort=
|limit=200
|link=none
|searchlabel=
}}