Unwanted characters when looping inside {{ slot }}
So I'm attempting to create a re-usable slider component where the slides are injected into {{ slot }} and I am seeing some unwanted characters coming through see here
My (simplified) antlers code
{{ partial
src="components/slider" // Only works with src
items="{{ items }}" // Doesn't work at all without this
}}
{{ items }} // If I add as="posts" here it outputs slightly less chars (see second img)
<li>
{{ title }}
{{ glide:featured_image width="400" height="400" }} // This doesn't seem to be causing the problem
</li>
{{ /items }}
{{ /partial }}
Then the main component
<div class="slider">
<ul>
{{ slot }}
</ul>
</div>
Partialising the slider items actually provided a fix for me: https://statamic.com/forum/5124-looping-inside-slots-unexpected-characters-ouput
Extra Detail
Screenshot of unwanted chars https://imgur.com/a/06gmlxC
Environment
Statamic 3.0.36 Pro Laravel 8.21.0 PHP 7.4.13 edalzell/blade-directives 2.1.1 edalzell/variable 1.0.3 statamic/ssg 0.2.0
Install method (choose one):
- Fresh install from
statamic/statamic
Try :items="items" rather than items="{{ items }}" in your partial tag.
Using the curly brace syntax will try to render the array into the parameter.
Using the : parameter syntax will actually pass the array along.