1

Is it possible to get the location (/media) and id (1) of an asset volume from within a Craft template?

1

Of course it is. You can get the volume as you want, for example

{% set volume = craft.app.getVolumes().getVolumeByHandle('images') %}

Of if you have an asset

{% set asset = craft.assetFieldHandly.one() %}
{% set volume = asset.getVolume() %}

And output the information

{{ volume.path }}
{{ volume.id }}

if {{ volume.path }} contains an alias you can do {{ alias(volume.path) }} to display the resolved path

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.