mise en place du début du back
This commit is contained in:
parent
5210d78d7d
commit
c1c4fda329
22 changed files with 1595 additions and 4 deletions
101
site/templates/article.php
Normal file
101
site/templates/article.php
Normal file
|
|
@ -0,0 +1,101 @@
|
|||
<?php snippet('header') ?>
|
||||
|
||||
<main class="article">
|
||||
<article class="article__content">
|
||||
<!-- Header -->
|
||||
<header class="article__header">
|
||||
<?php if ($page->date()->isNotEmpty()): ?>
|
||||
<time class="article__date" datetime="<?= $page->date()->toDate('Y-m-d') ?>">
|
||||
Publié le <?= $page->date()->toDate('d/m/Y') ?>
|
||||
</time>
|
||||
<?php endif ?>
|
||||
|
||||
<h1 class="article__title"><?= $page->title() ?></h1>
|
||||
|
||||
<?php if ($page->intro()->isNotEmpty()): ?>
|
||||
<p class="article__intro"><?= $page->intro() ?></p>
|
||||
<?php endif ?>
|
||||
</header>
|
||||
|
||||
<!-- Author -->
|
||||
<?php if ($page->author_name()->isNotEmpty()): ?>
|
||||
<div class="article__author">
|
||||
<?php if ($photo = $page->author_photo()->toFile()): ?>
|
||||
<img src="<?= $photo->url() ?>" alt="<?= $page->author_name() ?>" class="article__author-photo">
|
||||
<?php endif ?>
|
||||
|
||||
<div class="article__author-info">
|
||||
<span class="article__author-name"><?= $page->author_name() ?></span>
|
||||
<?php if ($page->author_role()->isNotEmpty()): ?>
|
||||
<span class="article__author-role"><?= $page->author_role() ?></span>
|
||||
<?php endif ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif ?>
|
||||
|
||||
<!-- Cover Image -->
|
||||
<?php if ($cover = $page->cover()->toFile()): ?>
|
||||
<figure class="article__cover">
|
||||
<img src="<?= $cover->url() ?>" alt="<?= $page->title() ?>">
|
||||
</figure>
|
||||
<?php endif ?>
|
||||
|
||||
<!-- Content -->
|
||||
<div class="article__body">
|
||||
<?= $page->article_content()->toBlocks() ?>
|
||||
</div>
|
||||
|
||||
<!-- Tags -->
|
||||
<?php if ($page->tags()->isNotEmpty()): ?>
|
||||
<div class="article__tags">
|
||||
<?php foreach ($page->tags()->split() as $tag): ?>
|
||||
<span class="article__tag"><?= $tag ?></span>
|
||||
<?php endforeach ?>
|
||||
</div>
|
||||
<?php endif ?>
|
||||
</article>
|
||||
|
||||
<!-- Recommendations -->
|
||||
<?php
|
||||
$related = $page->related_articles()->toPages();
|
||||
if ($related->isEmpty()) {
|
||||
$related = $page->siblings()->listed()->not($page)->shuffle()->limit(3);
|
||||
}
|
||||
?>
|
||||
|
||||
<?php if ($related->isNotEmpty()): ?>
|
||||
<section class="article__recommendations">
|
||||
<h2 class="article__recommendations-title">Nos recommandations</h2>
|
||||
<a href="<?= $page->parent()->url() ?>" class="article__recommendations-link">Voir tous les articles →</a>
|
||||
|
||||
<div class="article__recommendations-grid">
|
||||
<?php foreach ($related as $rec): ?>
|
||||
<article class="recommendation-card">
|
||||
<?php if ($cover = $rec->cover()->toFile()): ?>
|
||||
<div class="recommendation-card__cover">
|
||||
<img src="<?= $cover->thumb(['width' => 400])->url() ?>" alt="<?= $rec->title() ?>">
|
||||
</div>
|
||||
<?php endif ?>
|
||||
|
||||
<?php if ($rec->category()->isNotEmpty()): ?>
|
||||
<span class="recommendation-card__category"><?= $rec->category() ?></span>
|
||||
<?php endif ?>
|
||||
|
||||
<h3 class="recommendation-card__title">
|
||||
<a href="<?= $rec->url() ?>"><?= $rec->title() ?></a>
|
||||
</h3>
|
||||
</article>
|
||||
<?php endforeach ?>
|
||||
</div>
|
||||
</section>
|
||||
<?php endif ?>
|
||||
|
||||
<!-- Navigation -->
|
||||
<nav class="article__nav">
|
||||
<a href="<?= $page->parent()->url() ?>" class="article__nav-back">
|
||||
← Tous les articles
|
||||
</a>
|
||||
</nav>
|
||||
</main>
|
||||
|
||||
<?php snippet('footer') ?>
|
||||
Loading…
Add table
Add a link
Reference in a new issue