Template:Infobox Admin Subdivision: Difference between revisions
Template page
More actions
Eloise Zomia (talk | contribs) Created page with "<includeonly> <templatestyles src="Template:Infobox Admin Subdivision/styles.css" /> {| class="infobox lw-infobox lw-infobox--admin" |- ! colspan="2" class="lw-infobox__title" | {{{name|{{PAGENAME}}}}} |- {{#if:{{{local_name|}}}| ! colspan="2" class="lw-infobox__subtitle" {{!}} {{{local_name}}} {{!}}- }} {{#if:{{{image|}}}| {{!}} colspan="2" class="lw-infobox__media" {{!}} [[File:{{{image}}}|320px|{{{image_alt|{{{name|{{PAGENAME}}}}}}}}]] {{!}}- {{#if:{{{image_caption|}}..." |
Eloise Zomia (talk | contribs) No edit summary |
||
| (One intermediate revision by the same user not shown) | |||
| Line 18: | Line 18: | ||
}} | }} | ||
{{#if:{{{show_map|}}}| | {{#if:{{{show_map|}}}| | ||
{{!}} colspan="2" class="lw-infobox__map-container" {{!}} <div class="lw-infobox__map lw-map" data-smw-query="[[Category:Accessions]][[Has {{{admin_property|province}}}::{{PAGENAME}}]]{{!}}?Has coordinates{{!}}?Has descriptive name{{!}}?Has conservation priority{{!}}?Has accession ID"></div><div class="lw-infobox__map-expand" title="Expand map">⛶</div> | {{!}} colspan="2" class="lw-infobox__map-container" {{!}} <div class="lw-infobox__map lw-map" data-center="{{{coordinates|}}}" {{#if:{{{boundary|}}}|data-boundary="{{{boundary}}}" data-boundary-style="admin"}} data-smw-query="[[Category:Accessions]][[Has {{{admin_property|province}}}::{{{admin_value|{{PAGENAME}}}}}]]{{!}}?Has coordinates{{!}}?Has descriptive name{{!}}?Has conservation priority{{!}}?Has accession ID"></div><div class="lw-infobox__map-expand" title="Expand map">⛶</div> | ||
{{!}}- | {{!}}- | ||
}} | }} | ||
| Line 69: | Line 69: | ||
|- | |- | ||
! class="lw-infobox__label" | Growing Regions | ! class="lw-infobox__label" | Growing Regions | ||
| class="lw-infobox__value" | {{#ask:[[Category:Growing Regions]][[Has province::{{{ | | class="lw-infobox__value" | {{#ask:[[Category:Growing Regions]][[Has province::{{{admin_value|{{PAGENAME}}}}}]]|format=count}} | ||
|- | |- | ||
! class="lw-infobox__label" | Growing Areas | ! class="lw-infobox__label" | Growing Areas | ||
| class="lw-infobox__value" | {{#ask:[[Category:Growing Areas]][[Has province::{{{ | | class="lw-infobox__value" | {{#ask:[[Category:Growing Areas]][[Has province::{{{admin_value|{{PAGENAME}}}}}]]|format=count}} | ||
|- | |- | ||
! class="lw-infobox__label" | Accessions | ! class="lw-infobox__label" | Accessions | ||
| class="lw-infobox__value" | {{#ask:[[Category:Accessions]][[Has {{{admin_property|province}}}::{{{ | | class="lw-infobox__value" | {{#ask:[[Category:Accessions]][[Has {{{admin_property|province}}}::{{{admin_value|{{PAGENAME}}}}}]]|format=count}} | ||
|- | |- | ||
|} | |} | ||
| Line 90: | Line 90: | ||
|Has population={{{population|}}} | |Has population={{{population|}}} | ||
|Has population year={{{population_year|}}} | |Has population year={{{population_year|}}} | ||
|Has boundary={{{boundary|}}} | |||
}} | }} | ||
</includeonly> | </includeonly> | ||
| Line 95: | Line 96: | ||
== Usage == | == Usage == | ||
This template works for any level of administrative subdivision. Use the <code>subdivision_type</code>, <code>parent_label</code>, and <code> | This template works for any level of administrative subdivision. Use the <code>subdivision_type</code>, <code>parent_label</code>, <code>admin_property</code>, and <code>admin_value</code> parameters to adapt it to any country's hierarchy. | ||
=== Cambodia === | === Cambodia (district) === | ||
<pre> | <pre> | ||
{{Infobox Admin Subdivision | {{Infobox Admin Subdivision | ||
| Line 107: | Line 108: | ||
|parent_label = Province | |parent_label = Province | ||
|admin_property = admin 2 | |admin_property = admin 2 | ||
|admin_value = Kirivong | |||
|show_map = yes | |show_map = yes | ||
|coordinates = 10.641000, 104.844000 | |coordinates = 10.641000, 104.844000 | ||
| Line 113: | Line 115: | ||
</pre> | </pre> | ||
=== India === | === India (district) === | ||
<pre> | <pre> | ||
{{Infobox Admin Subdivision | {{Infobox Admin Subdivision | ||
| Line 123: | Line 125: | ||
|parent_label = State | |parent_label = State | ||
|admin_property = admin 2 | |admin_property = admin 2 | ||
|admin_value = Kullu | |||
|show_map = yes | |show_map = yes | ||
|coordinates = 31.958000, 77.109000 | |coordinates = 31.958000, 77.109000 | ||
| Line 149: | Line 152: | ||
! Parameter !! Description !! Default !! Example | ! Parameter !! Description !! Default !! Example | ||
|- | |- | ||
| name || Display name (defaults to page name) || {{PAGENAME}} || Kirivong | | name || Display name (defaults to page name) || <nowiki>{{PAGENAME}}</nowiki> || Kirivong | ||
|- | |- | ||
| local_name || Name in local script || || ស្រុកកិរីវង់ | | local_name || Name in local script || || ស្រុកកិរីវង់ | ||
| Line 170: | Line 173: | ||
|- | |- | ||
| admin_property || SMW property suffix for map/count queries || province || admin 2 | | admin_property || SMW property suffix for map/count queries || province || admin 2 | ||
|- | |||
| admin_value || Value to match in SMW queries (use when page name differs from stored property value) || <nowiki>{{PAGENAME}}</nowiki> || Kirivong | |||
|- | |- | ||
| capital || Administrative capital || || Doun Kaev | | capital || Administrative capital || || Doun Kaev | ||
| Line 188: | Line 193: | ||
=== The admin_property parameter === | === The admin_property parameter === | ||
This | This controls which SMW property the map query and accession count use to filter results. | ||
{| class="wikitable" | {| class="wikitable" | ||
| Line 194: | Line 199: | ||
! Admin level !! admin_property value !! Resulting query filter | ! Admin level !! admin_property value !! Resulting query filter | ||
|- | |- | ||
| Province/State || province || <code>[[Has province:: | | Province/State || province || <code><nowiki>[[Has province::…]]</nowiki></code> | ||
|- | |- | ||
| District || admin 2 || <code>[[Has admin 2:: | | District || admin 2 || <code><nowiki>[[Has admin 2::…]]</nowiki></code> | ||
|- | |- | ||
| Commune/Subdistrict || admin 3 || <code>[[Has admin 3:: | | Commune/Subdistrict || admin 3 || <code><nowiki>[[Has admin 3::…]]</nowiki></code> | ||
|- | |- | ||
| Village/Ward || admin 4 || <code>[[Has admin 4:: | | Village/Ward || admin 4 || <code><nowiki>[[Has admin 4::…]]</nowiki></code> | ||
|} | |} | ||
=== The admin_value parameter === | |||
When the wiki page name does not match the value stored in accession properties, use <code>admin_value</code> to override. For example, the page "Kirivong district" needs <code>admin_value = Kirivong</code> because accessions store <code>Has admin 2 = Kirivong</code> (without the "district" suffix). If omitted, defaults to <code><nowiki>{{PAGENAME}}</nowiki></code>. | |||
[[Category:Infobox templates]] | [[Category:Infobox templates]] | ||
</noinclude> | </noinclude> | ||
Latest revision as of 18:01, 28 March 2026
Usage
This template works for any level of administrative subdivision. Use the subdivision_type, parent_label, admin_property, and admin_value parameters to adapt it to any country's hierarchy.
Cambodia (district)
{{Infobox Admin Subdivision
|name = Kirivong
|local_name = ស្រុកកិរីវង់
|subdivision_type = District
|country = Cambodia
|parent = Takeo
|parent_label = Province
|admin_property = admin 2
|admin_value = Kirivong
|show_map = yes
|coordinates = 10.641000, 104.844000
|category = Cambodian Districts
}}
India (district)
{{Infobox Admin Subdivision
|name = Kullu District
|local_name = कुल्लू जिला
|subdivision_type = District
|country = India
|parent = Himachal Pradesh
|parent_label = State
|admin_property = admin 2
|admin_value = Kullu
|show_map = yes
|coordinates = 31.958000, 77.109000
|category = Indian Districts
}}
Province-level example
{{Infobox Admin Subdivision
|name = Takeo
|local_name = តាកែវ
|subdivision_type = Province
|country = Cambodia
|admin_property = province
|show_map = yes
|coordinates = 10.990000, 104.780000
|capital = Doun Kaev
|category = Cambodian Provinces
}}
Parameters
| Parameter | Description | Default | Example |
|---|---|---|---|
| name | Display name (defaults to page name) | {{PAGENAME}} | Kirivong |
| local_name | Name in local script | ស្រុកកិរីវង់ | |
| image | Hero image filename | Kirivong_landscape.jpg | |
| image_alt | Alt text for image | name value | Bayong Kor mountains |
| image_caption | Caption for hero image | View from Phnom Bayong | |
| show_map | Set to "yes" to display accession map | yes | |
| subdivision_type | What kind of division this is | Province | District |
| country | Country page name | Cambodia | |
| parent | Parent subdivision page name | Takeo | |
| parent_label | Label for the parent field | Province | Province |
| admin_property | SMW property suffix for map/count queries | province | admin 2 |
| admin_value | Value to match in SMW queries (use when page name differs from stored property value) | {{PAGENAME}} | Kirivong |
| capital | Administrative capital | Doun Kaev | |
| coordinates | Centroid (lat, lon) | 10.641000, 104.844000 | |
| area | Geographic area | 928 km² | |
| elevation_range | Elevation range | 50–400 m | |
| population | Population figure | 178,000 | |
| population_year | Census year for population | 2019 | |
| category | MediaWiki category for this page | Admin Subdivisions | Cambodian Districts |
The admin_property parameter
This controls which SMW property the map query and accession count use to filter results.
| Admin level | admin_property value | Resulting query filter |
|---|---|---|
| Province/State | province | [[Has province::…]]
|
| District | admin 2 | [[Has admin 2::…]]
|
| Commune/Subdistrict | admin 3 | [[Has admin 3::…]]
|
| Village/Ward | admin 4 | [[Has admin 4::…]]
|
The admin_value parameter
When the wiki page name does not match the value stored in accession properties, use admin_value to override. For example, the page "Kirivong district" needs admin_value = Kirivong because accessions store Has admin 2 = Kirivong (without the "district" suffix). If omitted, defaults to {{PAGENAME}}.