1

I have an Assets field assigned to my homepage. I can assign and upload images the same way I've always done.

When it comes to templating, I can loop through the images and output the filename. What I can't do anymore is get the URL. What am I missing?

{% set assets = entry.featured %}

{% if assets | length %}

    <h3>Some great assets</h3>
    {% for asset in assets %}
        <p>
          {{ asset.title }}<br />
          {{ asset.url }}
        </p>
    {% endfor %}

{% endif %}

The url's no longer return anything. I've also tried getUrl('someTransformHandle') too.

I can't see anything mentioned in the Craft 3 documentation for assets regarding any deprecations or significant changes.

2

Did you set up your Asset Volumes to have the proper paths/URLs? Do you have Assets in this volume have public URLs turned on?

Do you have a volumes.php configured to be multi-environment aware? It's not a necessary step, unless you require the now-deprecated environmentVariables settings:

https://docs.craftcms.com/v3/config/#aliases

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.