Search Templates & Merge Tags
Introduction
Gravity Search provides flexible output options for results, map info windows, and details views.
You can build output using selected fields or write custom HTML templates with merge tags.
Templates allow you to control how entry data, images, distance values, details links, and entry metadata appear on the front-end.

Output Modes
Structured Fields
Structured Fields mode builds each result item using settings such as:
- Title Field
- Main Image Field
- Distance Display
- Details Link
- Display Rows
This mode is useful when you want consistent output without maintaining custom HTML.
Structured Fields mode is available in Search Results, Map Info Windows, and Details View settings.

Custom Template Output
Custom Template mode renders each result item using the markup entered in the template editor.
You can use HTML, CSS classes, Gravity Forms merge tags, Gravity Search merge tags, entry metadata, distance values, and details links.

Supported Merge Tags
Merge Tags dynamically output data from the current entry being rendered. They can be used in Search Results templates, Map Info Windows, Details View templates, and other custom output areas that support merge tags.
Where Templates Can Be Used
- Search Results
- Map Info Windows
Each area supports Structured Fields mode and Custom Template mode.
Template Examples
Basic Result Item
<div class="directory-item">
<h3>{field:1|details_link}</h3>
<p>{field:3}</p>
<p>{distance}</p>
</div>
Result Item With Image
<div class="directory-card">
{field:5|image}
<h3>{field:1|details_link}</h3>
<p>{field:2}</p>
{details_link|View Full Details}
</div>
Table Row Template
<tr>
<td>{field:1|details_link}</td>
<td>{field:3}</td>
<td>{distance}</td>
<td>{date_created|format:Y-m-d}</td>
</tr>
Best Practices
- Use Structured Fields when you only need standard result layouts.
- Use Custom Template mode when the design requires custom markup.
- Use the Insert Merge Tag button when available to avoid typing field IDs manually.
- Keep templates focused on output; use Search Settings for query behavior.
- Test custom templates with entries that contain empty fields, images, and distance values.
- Use Structured Fields first and switch to Custom Templates only when additional layout flexibility is required.
