Creating a template filter to humanize URLs

Web users commonly recognize URLs without the protocol (http://) or trailing slash (/), and, similarly, they will enter URLs in this fashion in address fields. In this recipe, we will create a humanize_url filter that is used to present URLs to the user in a shorter format, truncating very long addresses, similar to what Twitter does with the links in tweets.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.147.104.230