Twig result/contents into string I'm trying to adjust a google maps so have pins that correspond with my posts. I'm nearly there but I'm trying to load info into the info window. I can set it's content already by hand. And I have turned the info i want in the bubble into a html result. All I need to do is alter this so that the twig commands create a string I can pass on in the function that will add the pin.

So I'm trying to create a string result from the code below, which has all the results in it.

Here's what I got (and this works to produce the HTML I want to put in the info window of the pin:

—

{% set resultsNum = 0 %}

&lt;h3&gt;{{ block.location }}&lt;/h3&gt;
&lt;ul&gt;
{% set searchString = block.location %}
{% for entry in craft.entries.section('journal').find() %}
{% for block in entry.locations %}
    {% if block.type == "location" %}
        {% if block.location == searchString %}
            {% set resultsNum = resultsNum+1 %}
            &lt;li&gt;&lt;a href="{{ entry.url() }}"&gt;{{ entry.title }}&lt;/a&gt;&lt;/li&gt;
        {% endif %}
    {% endif %}
{% endfor %}
{% endfor %}
&lt;/ul&gt;


—

The resulting string would go here (this code works already if i set my own string of html:

    {% set marker = {
    lat: result.geometry.location.lat,
    lng: result.geometry.location.lng,
    content: infoHTML 
    } %}


Thanks in advance for any help!
You can wrap your HTML in a {% set myString %} block and use myString however you need too. 

{% set myString %}
{% set resultsNum = 0 %}
&lt;h3&gt;{{ block.location }}&lt;/h3&gt;
&lt;ul&gt;
{% set searchString = block.location %}
{% for entry in craft.entries.section('journal').find() %}
{% for block in entry.locations %}
    {% if block.type == "location" %}
    {% if block.location == searchString %}
        {% set resultsNum = resultsNum+1 %}
        &lt;li&gt;&lt;a href="{{ entry.url() }}"&gt;{{ entry.title }}&lt;/a&gt;&lt;/li&gt;
    {% endif %}
{% endif %}
{% endfor %}
{% endfor %}
&lt;/ul&gt;
{% endset %}