Closed
Description
Bug description
The documentation for both the collection tag and the taxonomy tag show a list of variables, including $index
.
I cannot figure out how to access these variables in Blade. I've dump all_defined_vars but I don't see it there. Seems like a bug.
How to reproduce
Try to access $index in either the collection tag or the taxonomy tag, e.g.:
<statamic:collection from="blog">
<li><a href="{{ $url }}">{{ $index }} {{ $title }}</a></li>
</statamic:collection>
<s:taxonomy from="categories">
<li><a href="{{ $url }}">{{ $index }} {{ $title }}</a></li>
</s:taxonomy>
$index undefined!
WORKAROUND:
<s:taxonomy from="categories" as="categories">
@foreach($categories as $index => $category)
<li><a href="{{ $category->url }}">{{ $index }} {{ $category->title }}</a></li>
@endforeach
</s:taxonomy>
Logs
Environment
Version: 5.45.2 PRO
Installation
Fresh statamic/statamic site via CLI
Additional details
No response