I’m creating a blog-homepage template whereby blog posts are filtered by tags, and shown in the style of a showcase. My problem is that when trying to print the article’s cover-image in the showcase, I’m getting the cover-image’s name instead of the actual image. I’m certain theres something very silly I’m missing, but I just cannot seem to figure it out! My code is as follows:
<?php foreach($site->find('blog')->children()->flip()->limit(100) as $article): ?>
<div class="blog-item">
<a href="<?php echo $article->url() ?>">
<? if($image = $article->coverimage()): ?>
<?= $image->resize(500, 400)->html() ?>
<? endif ?>
<h1 class="blog-title"><?php echo $article->title()->html() ?></h1>
</a>
</div>
<?php endforeach ?>
Any help would be greatly appreciated! Thank you.