Overview
The Asset tag's primary purpose is to retrieve Assets by their URL. Pass the URL into the url
parameter and voila. To say it did any more than that would be a lie.
Example
{{ asset url="/img/brand/logo.png" }} <img src="{{ url }}" alt="{{ alt }}" />{{ /asset }}
{{-- Using Antlers Blade Components --}}<statamic:asset url="/assets/logo.png"> <img src="{{ $url }}" alt="{{ $alt }}" /></statamic:asset> {{-- Using Fluent Tags --}}@if ($asset = Statamic::tag('asset')->src('/assets/logo.png')->fetch()) <img src="{{ $asset->url }}" alt="{{ $asset->alt }}" />@endif
Parameters
url
string
The path to the file, relative to the web root.