Search code examples
liquidbusiness-catalyst

How do I escape an apostrophy in liquid? (Business Catalyst)


Im needing to call a json item with an apostrophy in it.

{% for item in search.items -%}
<a href="{{item.url}}">Position: {{item.['Position Title']}}</a><br>

<ul>
  <li><strong>State:</strong> {{item.['Vacancy State']}}</li>
  <li><strong>Numbers Required:</strong> {{item.["Numbers Req\'d Min"]}} - {{item.["Numbers Req\'d Max"]}}</li>
  <li><strong>Employer:</strong> {{item.['Employer Name']}}</li>
</ul>

<p><strong>Description</strong></p>
<div>{{item.description}}</div>

<ul>
  <li><strong>Listed Date:</strong> {{item.releaseDate | date}}</li>
  <li><strong>Expiry Date:</strong> {{item.expiryDate | date}}</li>
</ul>

{% endfor -%}

The {{item.["Numbers Req\'d Min"]}} - {{item.["Numbers Req\'d Max"]}}</li> section is not working as there is an apostrophe in the web app item. -> Req'd

Does any one know how I can successfully call this in Business Catalyst? I tried a \ but that is not working currently.


Solution

  • You should be able to use the code without escaping it.

    Try: {{item.["Numbers Req'd Min"]}}

    Since it is enclosed in " " it should work. When you escape the ' it sees the \ as a character and doesn't render correctly.