Troubleshooting: Assets don't have URLs

Trying to output an asset’s details and url is just blank?

Perhaps alt text, even width and height work, but not url?
You might have something like this:

  - path/to/image.jpg
{{ my_asset_field }}
    <img src="{{ url }}" alt="{{ alt }}" width="{{ width }}" height="{{ height }}" />
{{ /my_asset_field }}
<img src="" alt="An image" width="100" height="150" />

That’ll be because your Asset Container’s disk does not have a url configured.

# content/assets/my_container.yaml
disk: assets
// config/filesystems.php
'disks' => [
    'assets' => [
        'driver' => 'local',
        'root' => public_path('assets'),
        'visibility' => 'public',
        'url' => '/assets', // 👈 you're missing this

Asset containers using url-less disks are considered “private” and will intentionally not output URLs.

Read about private asset containers

Betterify this page on Github!