Statamic - How can I access assets and single assets with attributes?
up vote
0
down vote
favorite
In statamic, I have a container with images defined, and attributes set on those images. I then save a single asset page variable in page/index.md
photo: assets/main/image.jpg
I can use the method below, but only if I create a single image fieldset for the page, which is tedious.
{{ asset:photo }}
{{ glide src="{{ url }}" alt="{{ alt }}" />
{{ /asset:photo }}
{{ asset:photo }}
<img src="{{ value }}" alt="{{ alt }}" />
{{ /asset:photo }}
I can also make a container and put the single image in the container to access like below, but that is also tedious.
{{ assets container="photo" }}
<img src="{{ glide:id height="44" fit="crop_focal" }}" alt="{{ alt }}" />
{{ /assets }}
What is the best way to access single assets with their attributes without creating a container or fieldset every time? Bonus if I can also use glide to manipulate the image!
I resorted to using the below method, but cannot access any attributes this way.
<img src="{{ glide:photo height='44' fit='resize' }}" alt="Have to enter this attribute manually" />
assets statamic
add a comment |
up vote
0
down vote
favorite
In statamic, I have a container with images defined, and attributes set on those images. I then save a single asset page variable in page/index.md
photo: assets/main/image.jpg
I can use the method below, but only if I create a single image fieldset for the page, which is tedious.
{{ asset:photo }}
{{ glide src="{{ url }}" alt="{{ alt }}" />
{{ /asset:photo }}
{{ asset:photo }}
<img src="{{ value }}" alt="{{ alt }}" />
{{ /asset:photo }}
I can also make a container and put the single image in the container to access like below, but that is also tedious.
{{ assets container="photo" }}
<img src="{{ glide:id height="44" fit="crop_focal" }}" alt="{{ alt }}" />
{{ /assets }}
What is the best way to access single assets with their attributes without creating a container or fieldset every time? Bonus if I can also use glide to manipulate the image!
I resorted to using the below method, but cannot access any attributes this way.
<img src="{{ glide:photo height='44' fit='resize' }}" alt="Have to enter this attribute manually" />
assets statamic
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
In statamic, I have a container with images defined, and attributes set on those images. I then save a single asset page variable in page/index.md
photo: assets/main/image.jpg
I can use the method below, but only if I create a single image fieldset for the page, which is tedious.
{{ asset:photo }}
{{ glide src="{{ url }}" alt="{{ alt }}" />
{{ /asset:photo }}
{{ asset:photo }}
<img src="{{ value }}" alt="{{ alt }}" />
{{ /asset:photo }}
I can also make a container and put the single image in the container to access like below, but that is also tedious.
{{ assets container="photo" }}
<img src="{{ glide:id height="44" fit="crop_focal" }}" alt="{{ alt }}" />
{{ /assets }}
What is the best way to access single assets with their attributes without creating a container or fieldset every time? Bonus if I can also use glide to manipulate the image!
I resorted to using the below method, but cannot access any attributes this way.
<img src="{{ glide:photo height='44' fit='resize' }}" alt="Have to enter this attribute manually" />
assets statamic
In statamic, I have a container with images defined, and attributes set on those images. I then save a single asset page variable in page/index.md
photo: assets/main/image.jpg
I can use the method below, but only if I create a single image fieldset for the page, which is tedious.
{{ asset:photo }}
{{ glide src="{{ url }}" alt="{{ alt }}" />
{{ /asset:photo }}
{{ asset:photo }}
<img src="{{ value }}" alt="{{ alt }}" />
{{ /asset:photo }}
I can also make a container and put the single image in the container to access like below, but that is also tedious.
{{ assets container="photo" }}
<img src="{{ glide:id height="44" fit="crop_focal" }}" alt="{{ alt }}" />
{{ /assets }}
What is the best way to access single assets with their attributes without creating a container or fieldset every time? Bonus if I can also use glide to manipulate the image!
I resorted to using the below method, but cannot access any attributes this way.
<img src="{{ glide:photo height='44' fit='resize' }}" alt="Have to enter this attribute manually" />
assets statamic
assets statamic
edited Nov 21 at 21:15
asked Nov 21 at 21:02
Nikki Aaron
255
255
add a comment |
add a comment |
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53420429%2fstatamic-how-can-i-access-assets-and-single-assets-with-attributes%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown