Customizing query results: Difference between revisions

From Maps for MediaWiki
mNo edit summary
mNo edit summary
Line 66: Line 66:
}}
}}


Template content: <code>The city '''[[{{{title}}}]]''' is located in [[{{{Located in}}}]]. It has a population of {{{Population}}} and surface area of {{{Surface area}}} km²</code>
Template content:
 
<pre>
The city '''[[{{{title}}}]]''' is located in [[{{{Located in}}}]].
 
It has a population of {{{Population}}} and surface area of {{{Surface area}}} km²
</pre>

Revision as of 07:46, 15 May 2020

This page is about customization of the information that is shown when clicking a marker or shape on a map showing the result of a Semantic MediaWiki query.

Default behavior

By default the name of the page is shown. If addition properties are queried, they are shown in a list below the title.

{{#ask:[[Category:Cities]]
 | format=map
 | ?Coordinates
 | ?Located in
 | ?Population
 | ?Surface area
}}
Loading map...

Parameters

Parameters relevant for customization:

  • template
  • showtitle
  • hidenamespace
  • userparam

For a full list of parameters you can use in the map formats, see Leaflet SMW queries and Google Maps SMW queries.

Templates

Templates allow you to fully customize what gets shown in the popups.

Templates are specified with the template parameter, which takes the name of a template on your wiki. The showtitle parameter is often useful here, as setting it to no allows you to have full control over the popup content.

This example shows usage of multiple queried values via the "City Popup" template.

{{#ask:[[Category:Cities]]
 | format=map
 | ?Coordinates
 | ?Located in
 | ?Population
 | ?Surface area
 | template=City Popup
 | showtitle=off
}}
Loading map...

Template content:

The city '''[[{{{title}}}]]''' is located in [[{{{Located in}}}]].

It has a population of {{{Population}}} and surface area of {{{Surface area}}} km²