Customizing query results: Difference between revisions

From Maps for MediaWiki
m (Jeroen De Dauw moved page Queries with templates to Customizing query results)
mNo edit summary
Line 1: Line 1:
As parts of its [[Semantic MediaWiki|integration with Semantic MediaWiki]], Maps adds several mapping result formats. These formats all support the <code>template</code> parameter, which can be used to customize the information shown when clicking a marker or shape.
This page is about customization of the information that is shown when clicking a marker or shape on a [[Semantic MediaWiki|map showing the result of a Semantic MediaWiki query]].


== Default display without template ==
== Default behavior ==


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


<pre>
<pre>
Line 24: Line 24:
}}
}}


== Using a template ==
== Parameters ==
 
Parameters relevant for customization:
 
* <code>template</code>
* <code>showtitle</code>
* <code>hidenamespace</code>
* <code>userparam</code>
 
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 <code>template</code> parameter, which takes the name of a template on your wiki. The <code>showtitle</code> parameter is often useful here, as setting it to <code>no</code> allows you to have full control over the popup content.


This example shows usage of multiple queried values via the [[Template:City Popup|"City Popup" template]].
This example shows usage of multiple queried values via the [[Template:City Popup|"City Popup" template]].
Line 50: Line 65:
  | scrollzoom=off
  | scrollzoom=off
}}
}}
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>

Revision as of 07:45, 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²