I have a blog that shows 25 posts on the home page. Each post is displayed as a "block", with a dedicated "component" view being included 25 times. In this view there are 5 more inclusions (partials) leading to a total of 125 filesystem calls. I don't like this.
Code to understand better:
// home.blade.php
@foreach($posts as $post)
@include('components.post', ['post' => $post])
@endforeach
// components/post.blade.php
<div class="card">
@include('components.post.partials.category')
@include('components.post.partials.header')
@include('components.post.partials.content')
@include('components.post.partials.tags')
@include('components.post.partials.share')
</div>
What is the best practice for handling this situation? I was not been able to find information about it although it is a common operation...