I wonder, if there is not a {{#foreach content }}{{/foreach}} theme helper:
Looping through the content of a post/page, where I have access to the
provided components (images, galleries, markdowns, html …) before or after they are rendered.
I also haven’t found an Content API Endpoint for that.
There’s just one content object per post or page. If you need to process it, look at client side JavaScript.
So I can do something like
{{#get "pages" filter="tag:swipe" as |pages|}}
{{#foreach pages}}
<div style="display: none">
{{content}}
</div>
{{/foreach}}
{{/get}}
and then I parse it client side:
<script>
const images = document.querySelectorAll('.kg-image-card img, .kg-gallery-card img');
const slidediv = document.querySelector('.swiper-wrapper');
let html = []
images.forEach(function (image) {
html.push(`<div class="swiper-slide">
<div class="slide-img">
<img src="${image.src}" >
</div>
</div>`)
});
slidediv.innerHTML = html
</script>
This seems the only way …
Thank you.