How can I convert text into a URL-friendly string? If I want to convert text into a URL friendly string for sharing text in a social media link, how would I go about that?
I was about to ask this question, but realized that it's closely related to this question.

The answer, like in the above referenced question lies with Twig filters.

Specifically, in this case, one needs to use the url_encode filter to convert the text needed.

Example

&lt;a href="http://www.linkedin.com/shareArticle?mini=true&amp;url={{ entry.url|url_encode }}&amp;title={{ entry.title|url_encode }}&amp;source=Xavier%20Creative%20House&amp;summary={{ entry.question|url_encode|striptags }}" target="_blank"&gt;


In any case, I hope that helps others with this. I know how easy it is to forget that the answers sometimes like over in the Twig docs, and not Craft’s.