TransWikia.com

Relative Asset URL

Craft CMS Asked on March 19, 2021

I’m looking to output the relative URL of my assets instead of the full URL with domain for my Imgix config. As imgix puts it in their docs:

http://www.yourcompany.imgix.com/images/examples/pic.jpg

Currently, my assets are rendering like so:

http://www.yourcompany.imgix.com/http://www.localmachine/images/examples/pic.jpg

Looking at this as my code:

https://domain.imgix.net/{{ image.FeaturedImage[0].url }}

Is there a way to just output a relative URL instead of absolute? (I’ve looked at plugins for imgix, but seems a bit overkill if it just needs a relative URL?)

One Answer

{{ image.FeaturedImage[0].path }} may be what you are looking for, this will give you the folder and the filename of an asset.

Correct answer by dmatthams on March 19, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP