Answers.Body: <p>Of course it is. You can get the volume as you want, for example</p>
  
  <pre class="lang-twig prettyprint-override"><code>{% set volume = craft.app.getVolumes().getVolumeByHandle('images') %}
  </code></pre>
  
  <p>Of if you have an asset</p>
  
  <pre class="lang-twig prettyprint-override"><code>{% set asset = craft.assetFieldHandly.one() %}
  {% set volume = asset.getVolume() %}
  </code></pre>
  
  <p>And output the information</p>
  
  <pre class="lang-twig prettyprint-override"><code>{{ volume.path }}
  {{ volume.id }}
  </code></pre>
  
  <p>if <code>{{ volume.path }}</code> contains an alias you can do <code>{{ alias(volume.path) }}</code> to display the resolved path</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-08-12T13:57:15.173Z
Answers.LastActivityDate: 2018-08-12T13:57:15.173Z
Answers.UserDisplayName: Robin Schambach
Body: <p>Is it possible to get the location (/media) and id (1) of an asset volume from within a Craft template?</p>
  
Tags: <templating>
Title: Get the location and id of asset volumne
ThreadText: # Get the location and id of asset volumne
  
  (Asked by: username_0 on 2018-08-12)
  
  Is it possible to get the location (/media) and id (1) of an asset volume from within a Craft template?
  
  **Tags:** templating
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2018-08-12. Score: 1 | Accepted answer
  
  Of course it is. You can get the volume as you want, for example
  
  ```twig
  {% set volume = craft.app.getVolumes().getVolumeByHandle('images') %}
  
  ```
  
  Of if you have an asset
  
  ```twig
  {% set asset = craft.assetFieldHandly.one() %}
  {% set volume = asset.getVolume() %}
  
  ```
  
  And output the information
  
  ```twig
  {{ volume.path }}
  {{ volume.id }}
  
  ```
  
  if `{{ volume.path }}` contains an alias you can do `{{ alias(volume.path) }}` to display the resolved path
  
  
  ---
  
  