<?php if ($WHERE_AM_I == 'home'): ?>
<!-- Feature post -->
<div class="container-fluid pt-3 pb-3">
    <div class="row">
        <?php
          $featured = array_slice($content, 0, 1);
          $content = array_slice($content, 1);
          foreach ($featured as $page):
        ?>
        <div class="col-md-7">
            <a href="<?php echo $page->permalink(); ?>"><img src="<?php echo ($page->coverImage()?$page->coverImage():Theme::src('img/noimage.png')) ?>" class="img-fluid rounded" alt="<?php echo $page->title(); ?>"></a>
        </div>
        <div class="col-md-5">
            <p class="lead text-success pt-3 fw-bold"><?php echo $page->category() ?></p>
            <h1 class="fw-bold"><a class="fw-bold text-decoration-none text-dark" href="<?php echo $page->permalink(); ?>"><?php echo $page->title(); ?></a></h1>
            <p class="lead pt-2"><?php echo $page->date(); ?></p>
            <p class="lead text-secondary"><?php echo (empty($page->description())?'Complete the description of the article for a correct work of the theme':$page->description()) ?></p>
        </div>
        <?php endforeach ?>
    </div>
</div>
<!--/ Feature post -->
<?php endif; ?>
<div class="container-fluid pt-4 pb-4">
    <div class="row">
        <!-- All post -->
        <div class="col-md-9 pb-4">
            <div class="row row-cols-1 row-cols-md-3 g-4">
                <?php if (empty($content)) { $language->p('No pages found'); } ?>
                <?php foreach ($content as $page): ?>
                <div class="col">
                    <div class="card h-100 border-light">
                        <a href="<?php echo $page->permalink(); ?>"><img src="<?php echo ($page->coverImage()?$page->coverImage():Theme::src('img/noimage.png')) ?>" class="card-img-top" alt="<?php echo $page->title(); ?>"></a>
                        <div class="card-body">
                            <p class="fw-bold text-success"><?php echo $page->category() ?> <span class="text-secondary"><small><?php echo $page->date(); ?></small></span></p>
                            <h6 class="card-title"><a class="fw-bold text-decoration-none text-dark" href="<?php echo $page->permalink(); ?>"><?php echo $page->title(); ?></a></h6>
                        </div>
                    </div>
                </div>
                <?php endforeach ?>
            </div>
            <?php if (Paginator::numberOfPages()>1): ?>
            <!-- Nav -->
            <div class="d-flex justify-content-center">
                <div class="btn-group pt-4 pb-4" role="group" aria-label="Basic outlined example">
                    <?php if (Paginator::showPrev()): ?>
                    <a href="<?php echo Paginator::previousPageUrl() ?>" class="btn btn-outline-dark"><i class="fas fa-arrow-left"></i></a>
                    <?php endif ?>
                    <?php if (Paginator::showNext()): ?>
                    <a href="<?php echo Paginator::nextPageUrl() ?>" class="btn btn-outline-dark"><i class="fas fa-arrow-right"></i></a>
                    <?php endif ?>
                </div>
            </div>
            <!--/ Nav -->
            <?php endif ?>
        </div>
        <!--/ All post -->
        <!-- Sidebar -->
        <div class="col-md-3">
            <h4 class="fw-bold pb-3">MOST READ</h4>
            <!-- post side -->
            <?php
            $listOfKeys = $pages->getList(1, 8);
            if ($listOfKeys) :
            foreach ($listOfKeys as $key) :
            $lPage = new Page($key);
            ?>
            <p class="border-bottom pb-3">
            <a class="fw-bold text-decoration-none text-dark" href="<?php echo $lPage->permalink() ?>"><?php echo $lPage->title() ?></a>
            </p>
            <?php endforeach ?>
            <?php endif ?>
            <!-- post side -->
        </div>
        <!--/ Sidebar -->
    </div>
</div>
