2

I have a list of addresses in a table and I want it so that if you click on the address, you get a Google Maps link to that place. Here is my attempt; the <a ...> is my attempt at getting it but ultimately failing. I want a sample google maps page to take you to https://www.google.com/maps/search/?api=1&query=40%2C-70 if (40,-70) was the lat/long so that it actually shows the latitude/longitude described in the fields.

<table>
<tr>
  <th>Name</th>
  <th>Address</th>
  <th>Zip Code</th>
</tr>
<tbody>
  {% for pl in markers %}
  <tr>
    <td>{{pl.fields.name}}</td>
    <td><a href="https://www.google.com/maps/search/?api=1&query="pl.fields.latitude"%2C"pl.fields.longitude">{{pl.fields.address}}</a></td>
    <td>{{pl.fields.zip}}</td>
  </tr>
  {% endfor %}
</tbody>
Here is what is outputted:

enter image description here

The links should direct to the google maps API for the latitude/longitude, but right now it doesn't work. How would I go about doing that?

Minal Chauhan
  • 6,025
  • 8
  • 21
  • 41

1 Answers1

1

The extra quotes are throwing it off.

<table>
<tr>
  <th>Name</th>
  <th>Address</th>
  <th>Zip Code</th>
</tr>
<tbody>
  {% for pl in markers %}
  <tr>
    <td>{{pl.fields.name}}</td>
<td><a href="https://www.google.com/maps/search/?api=1&query={{pl.fields.latitude}},{{pl.fields.longitude}}">{{pl.fields.address}}</a></td>
    <td>{{pl.fields.zip}}</td>
  </tr>
  {% endfor %}
</tbody>
Kinglish
  • 23,358
  • 3
  • 22
  • 43