Jump to content

Template:Infobox/doc: Difference between revisions

From WikiJournal
mNo edit summary
Tag: 2017 source edit
mNo edit summary
Tag: 2017 source edit
 
(One intermediate revision by the same user not shown)
Line 27: Line 27:
}}
}}
</includeonly>
</includeonly>
<noinclude>
{{documentation}}
</noinclude>
</pre>
</pre>


Line 35: Line 32:
When creating templates based on <code><nowiki>{{Infobox}}</nowiki></code>, you can add additional parameters for inserting maps, links to thematic portals and other sections at your discretion:
When creating templates based on <code><nowiki>{{Infobox}}</nowiki></code>, you can add additional parameters for inserting maps, links to thematic portals and other sections at your discretion:
<pre>
<pre>
    {{#if:{{{map|}}} | <div class="infobox-map">{{{map}}}</div> }}
{{#if:{{{map|}}} | <div class="infobox-map">{{{map}}}</div> }}
      
      
    {{#if:{{{portal|}}} |  
{{#if:{{{portal|}}} |  
      <div class="infobox-section" style="background:#ffe2b8;">Thematic Portals</div>
    <div class="infobox-section" style="background:#ffe2b8;">Thematic Portals</div>
      <div class="infobox-portal">{{{portal}}}</div>
    <div class="infobox-portal">{{{portal}}}</div>
    }}
}}
</pre>
</pre>
Now this template can be used in city articles as follows:
Now this template can be used in city articles as follows:
Line 52: Line 49:
}}
}}
</pre>
</pre>
=== How to customize Infobox for your needs? ===
=== How to customize Infobox for your needs? ===
# Choose the type of object for which you need an infobox (city, river, nature reserve, etc.).
# Choose the type of object for which you need an infobox (city, river, nature reserve, etc.).

Latest revision as of 12:33, 17 February 2025

The Infobox template is a universal base template designed for creating information boxes in wiki articles. It serves as the foundation for specialized infoboxes (e.g., for gorges, cities, rivers, etc.), ensuring a standardized appearance and structure.

Using Infobox in specialized templates

To create a new infobox for a specific type of object, you need to use the Infobox template within your own template, passing the appropriate parameters.

  • {{Infobox ... }} — includes the base infobox.
  • title, image, description, header color — are passed directly to Infobox.
  • parameters — contains a list of fields that will be displayed if provided in the template (e.g., country, region).

Creating a new infobox based on Infobox

To create a new infobox (for example, for a city), follow the structure below and adjust the list of parameters for the desired object. Example structure for a city infobox:

<includeonly>
{{Infobox
 | title = {{{city name|}}}
 | image = {{{photo|}}}
 | description = {{{description|}}}
 | header color = #87CEEB
 | parameters = 
    {{#if:{{{country|}}} | <div class="infobox-row">
        <div class="infobox-label">Country:</div> 
        <div class="infobox-value">[[{{{country}}}]]</div>
    </div> }}
    {{#if:{{{population|}}} | <div class="infobox-row">
        <div class="infobox-label">Population:</div> 
        <div class="infobox-value">{{{population}}}</div>
    </div> }}
}}
</includeonly>

Additional parameters

When creating templates based on {{Infobox}}, you can add additional parameters for inserting maps, links to thematic portals and other sections at your discretion:

{{#if:{{{map|}}} | <div class="infobox-map">{{{map}}}</div> }}
    
{{#if:{{{portal|}}} | 
    <div class="infobox-section" style="background:#ffe2b8;">Thematic Portals</div>
    <div class="infobox-portal">{{{portal}}}</div>
}}

Now this template can be used in city articles as follows:

{{City
 | city name = Paris
 | photo = Paris.jpg
 | description = View of the Eiffel Tower
 | country = France
 | population = 2,165,423
}}

How to customize Infobox for your needs?

  1. Choose the type of object for which you need an infobox (city, river, nature reserve, etc.).
  2. Create a new template that uses Infobox as its base.
  3. Add the necessary parameters by passing them to the parameters section.
  4. Customize the infobox by changing the header color, adding new fields, and adjusting styles.