I have successfully used twitter-text.js to convert tweets containing links into clickable HTML before, but cannot get it to work as expected on this deployment. I am calling it as before:
twitterdata.results[i].text = twttr.txt.autoLink(twitterdata.results[i].text);
where twitterdata.results is an array of results from my API call.
The original tweet in ‘view source’ without using Twitter-text.js would look like:
Wow what a great day here are some photos: Click http://www.google.com
Using Twitter-text.js it inserts the correct < a href> etc, but then it displays as plain text like :
Wow what a great day here are some photos: Click <a href="http://www.google.com" rel="nofollow" >http://www.google.com</a>
and the links are not clickable, as if it is ignoring the HTML elements.
What could be stopping it from working? Thanks.
Sovled.
Issue was as expected , html coming in plaintext. Using Twig templates meant Jquery Template couldn’t escape properly.
The
{% raw %}escapes the Twig and the{{ html }}changes the input in the jQuery Template as needed.