Get file name from url in liquid

Solved
Highlighted
New Member
2 0 0

Suppose I have the liquid code here:

{{ article.image | img_url: '800x' }}

And the actual url is something like below

https://cdn.shopify.com/s/files/1/0592/4833/articles/blog-sheets_800x.jpg?v=1521158586

 

What liquid code can I use to extract just the file name from the url (without any version number). So for example: 

blog-sheets_800x.jpg

 

0 Likes
Highlighted
Shopify Partner
1365 24 239

This is an accepted solution.

@jdem 

try 

{{ article.image | split: '/' | last }}

{{ article.image }} will return articles/image_name

https://sections.design tips, tricks & Shopify sections
1 Like
Highlighted
Explorer
66 2 8

A little bit different than the subject, but my problem if the following:

I have a link to the collection page on my store's homepage (Debut -theme). I'm trying to create anchor link to the link which goes homepage->collection page

Question: How I find the file in "Edit code" where I can change the URL (which includes the anchor link)?

 

Thanks,

-KJ

0 Likes