I have the text on my website appear from a .json file, and I want to have the line appear as:
Phone: 123-456-7890
Local: 012-35-6789
Instead I am getting:
Phone: 123-456-7890 Local: 012-35-6789
My code:
footer{
"call_us": "Phone: {phone_number} \n Local: 012-345-6789"
}
Is there something besides \n I should be using?
Edit:
I am calling the JSON text to be displayed using the following code. I believe this is using Handlebars
{{#if settings.phone_number}}
<strong>{{lang 'footer.call_us' phone_number=settings.phone_number}}</strong>
{{/if}}
Full Code:
<article class="footer-info-col footer-info-col--small" data-section-type="storeInfo">
<h5 class="footer-info-heading">{{lang 'footer.info'}}</h5>
<address>{{nl2br settings.address}}</address>
<script> var footer={
"call_us": "Phone: {phone_number} \n Local: 012-345-6789"
}
for (var key in footer) {
if (footer.hasOwnProperty(key)) {
console.log(footer[key]);
}
}</script>
<!--{{#if settings.phone_number}}
<strong>{{lang 'footer.call_us' phone_number=settings.phone_number}}</strong>-->
{{/if}}
</article>
\r
It's that simple. I've been trying to figure this out too for a mastodon bot using tracery.
If you use \r you'll get a carriage return.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With