I am wondering if there is a liquid filter that restricts the URL to only the domain name.
For example, let's say I wanted to have a link to an article called "The Greatest Article Ever", and the URL was something uncomfortable, like http://example.com/long/ugly/directory/123948/name . Let them also say that I had both of these values ββin my YAML metadata in the array as "title:" and "url:" respectively, and my desired result was something like this:
<div class="cool-articles"> <a href="http://example.com/long/ugly/directory/123948/name"> The Greatest Article Ever </a> <span>example.com</span> </div>
How can I use liquid to restrict an item.url array to only a domain name?
I was looking for a good filter in liquid documents to do this, but I only found a deletion (which can use "http: //"), but there was nothing to just delete everything except the domain name.
Anyone have any thoughts?
Thanks!
source share