world-game/site/templates/blog.php

61 lines
2 KiB
PHP

<?php snippet('header') ?>
<main class="blog">
<!-- Intro Section -->
<section class="blog__intro">
<h1 class="blog__title"><?= $page->intro_title() ?></h1>
<?php if ($page->intro_text()->isNotEmpty()): ?>
<p class="blog__subtitle"><?= $page->intro_text() ?></p>
<?php endif ?>
</section>
<!-- Articles List -->
<section class="blog__articles">
<?php foreach ($page->children()->listed()->sortBy('date', 'desc') as $article): ?>
<article class="article-card">
<!-- Date -->
<?php if ($article->date()->isNotEmpty()): ?>
<time class="article-card__date" datetime="<?= $article->date()->toDate('Y-m-d') ?>">
<?= $article->date()->toDate('d/m/Y') ?>
</time>
<?php endif ?>
<!-- Content -->
<div class="article-card__content">
<h2 class="article-card__title">
<a href="<?= $article->url() ?>"><?= $article->title() ?></a>
</h2>
<?php if ($article->intro()->isNotEmpty()): ?>
<p class="article-card__intro"><?= $article->intro()->excerpt(200) ?></p>
<?php endif ?>
<a href="<?= $article->url() ?>" class="article-card__link">
Lire la suite &rarr;
</a>
</div>
<!-- Author -->
<div class="article-card__author">
<?php if ($photo = $article->author_photo()->toFile()): ?>
<img src="<?= $photo->url() ?>" alt="<?= $article->author_name() ?>" class="article-card__author-photo">
<?php endif ?>
<?php if ($article->author_name()->isNotEmpty()): ?>
<span class="article-card__author-name"><?= $article->author_name() ?></span>
<?php endif ?>
</div>
<!-- Cover Image -->
<?php if ($cover = $article->cover()->toFile()): ?>
<div class="article-card__cover">
<img src="<?= $cover->url() ?>" alt="<?= $article->title() ?>">
</div>
<?php endif ?>
</article>
<?php endforeach ?>
</section>
</main>
<?php snippet('footer') ?>