Cant' access meta data from files

Hi there!
having trouble accessing meta data from files.
I have a gallery and meta.yaml files.
The name of files and meta filess follow the rules:

00x-image.jpg
00x-image.jpg.meta.yaml

Inside meta.yaml file I’ve got the following information:

meta.alt_text: My alt text
meta.description: Description

And I’m publishing a photo gallery:

	<div id="photoswipe-gallery-id" class="row justify-content-center">
		{% for item in page.media.images %}
			<a href="{{ item.url|e }}" class="gallery-item" data-size="{{ item.width ~ 'x' ~ item.height }}">
				<img src="{{ item.cropResize(500, 250).url|e }}" loading="lazy" alt="{{ item.meta.alt_text }}"/>
			</a>
			
			{{ dump(item) }}
		{% endfor %}
	</div>

In the past project I’ve used to access meta data in such way: {{ item.meta.alt_text }}

But now I’m getting null data.

The dump(item) shows this information, and meta.alt_text is present in array
But it seems I’m doing something wrong…

@01K, Try removing the meta. inside the yaml file:

alt_text: My alt text
description: Description

Changing {{ item.meta.alt_text }} to {{ item.meta.meta.alt_text }} won’t work. Dotted names are valid Yaml field names but the dot does not have any special meaning. They are not separators. Twig will try to interpret the dot as a separator and will therefor not be able to find the value.

1 Like

Thank you very much!