stores/city/den-haag: the city of the URL, with its stores in a list and on a map. A URL that isn't a city gives a 404. The search form goes to the main store locator (result_url), a search there isn't limited to this city.
city="{segment_3}"shows the stores of the city, by its URL title (den-haag) or name.schema="yes"adds the stores as a schema.orgItemList, with a link to the page of each store.
Template
{exp:reinos_maps_locator:regions channel="stores" region="{segment_3}" url="stores/city"}
{if no_results}{redirect="404"}{/if}
<html>
<head>
<title>Bike stores in {region_name}</title>
<meta name="description" content="{region_count} bike stores in {region_name}: addresses, opening hours and directions.">
<link rel="canonical" href="{region_url}">
{exp:reinos_maps:html_header}
</head>
<body>
<h1>Bike stores in {region_name}</h1>
{/exp:reinos_maps_locator:regions}
{exp:reinos_maps_locator:locator
channel="stores"
city="{segment_3}"
result_url="stores"
schema="yes"
schema:type="BikeStore"
schema:url="stores/detail"
}
{exp:reinos_maps:html_footer}
</body>
</html>Build it in your own site
What this example needs in ExpressionEngine, step by step.
- Install Maps Locator and Maps.
- Create the field, with these short names:
Short name Type Notes store_locationMaps Set the field setting Mode to Single location: one marker per store, placed with the search field. Maps Locator indexes that marker, so this one field is the location for the map and the search. - Create the channel
stores(Stores) and assign the field. - In the settings of Maps Locator, turn on Reverse geocoding: a marker of a Maps field is saved as a coordinate, the reverse geocoding looks up its address and city (the city pages and a search on a city need them).
- Put the code in the template
stores/city: the code links to it. - Add a few stores (the demo site has 34 bike stores in the Netherlands).
- Open
/stores/city/utrecht(with the URL title of one of your entries).
This example comes from the Maps Locator docs: the preview runs exactly the code above.