Documentation

Search Templates & Merge Tags

Last modified: June 16, 2026

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.

Gravity Search Info Window Render Mode

Output Modes

1. Structured Fields

Structured Fields mode lets you select fields and configure rows without writing custom HTML.
This is the recommended option for most search pages.


2. Custom Template

Custom Template mode lets you write custom markup and insert entry data using merge tags.
Use this when you need full control over the result item layout.

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.

Gravity Search Info Window Structured Output

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.

Gravity Search Custom Output Settings

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.

1. Entry Tags

  • {entry_id} outputs the entry ID.
  • {details_url} outputs the entry Details Page URL.
  • {details_link} outputs a default details link.
  • {details_link|View Details} outputs a details link with a custom label.

2. Distance Tags

  • {distance} outputs the calculated distance as text.
  • {distance|html} outputs formatted distance HTML.

Distance tags only output values when proximity or distance data is available for the result.


3. Field Tags

Field Tags provide direct access to values stored in Target Form fields.

  • {field:4} outputs the value of field ID 4.
  • {field_label:4} outputs the label for field ID 4.
  • {field:4|html} outputs a formatted field row.
  • {field:4|image} outputs the field value as an image when a valid image URL is available.
  • {field:4|details_link} links the field value to the Details Page.
  • {field:4|details_link:new_tab} links the field value to the Details Page in a new tab.

4. Gravity Forms Field Tags

Gravity-style field merge tags are also supported.

{Business Name:4}

The field ID at the end of the tag is used to resolve the value from the Target Form entry.

This format follows the standard Gravity Forms merge tag syntax and may feel familiar to existing Gravity Forms users.


5. Entry Meta Tags

  • {date_created}
  • {date_updated}
  • {created_by}
  • {status}
  • {source_url}
  • {form_id}
  • {post_id}
  • {payment_status}
  • {payment_amount}
  • {transaction_id}

Date values can also be formatted.

{date_created|format:F j, Y}

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.
menu-circle