index-main/site/templates/news-item.php

87 lines
3.2 KiB
PHP
Raw Normal View History

2026-02-25 15:22:34 +01:00
<?php snippet('header') ?>
<?php
$lang = kirby()->language();
$locale = $lang ? $lang->locale(LC_ALL) : 'fr_FR.UTF-8';
$dateLocale = substr(is_array($locale) ? reset($locale) : $locale, 0, 5);
?>
<main class="main__single">
<header class="page__header">
<p class="page__type"><?= t('news.type') ?></p>
<?php
$categories = $page->category()->split();
$category = $categories[0] ?? '';
?>
<?php if ($category): ?>
<p class="page__category"><?= esc($category) ?></p>
<?php endif ?>
<h2 class="page__title"><?= $page->title()->esc() ?></h2>
<?php if ($page->created()->isNotEmpty()): ?>
<time class="date" datetime="<?= $page->created()->toDate('yyyy-MM-dd') ?>"><?= $page->created()->toDate('d MMMM yyyy', $dateLocale) ?></time>
<?php endif ?>
<?php if ($page->chapo()->isNotEmpty()): ?>
<p class="page__description"><?= $page->chapo()->inline() ?></p>
<?php endif ?>
<?php if ($cover = $page->cover()->toFile()): ?>
<figure class="page__cover">
<?php snippet('picture', ['file' => $cover]) ?>
</figure>
<?php endif ?>
</header>
<div class="page__content">
<?php if ($page->body()->isNotEmpty()): ?>
<?= $page->body()->toBlocks() ?>
<?php endif ?>
</div>
<?php $investigations = $page->linkedInvestigations()->toPages() ?>
<?php if ($investigations->isNotEmpty()): ?>
<aside class="page__aside" id="related-investigations">
<h3 class="aside__title"><?= t('investigations.related') ?></h3>
<?php foreach ($investigations as $investigation): ?>
<article class="card--article-small">
<?php if ($cover = $investigation->cover()->toFile()): ?>
<figure>
<img src="<?= $cover->url() ?>" alt="<?= $investigation->title()->esc() ?>">
</figure>
<?php endif ?>
<div class="content">
<p class="type"><?= t('investigation.type') ?></p>
<h4 class="title"><a href="<?= $investigation->url() ?>"><?= $investigation->title()->esc() ?></a></h4>
<?php if ($investigation->incidentDate()->isNotEmpty()): ?>
<time class="date" datetime="<?= $investigation->incidentDate()->toDate('yyyy-MM-dd') ?>"><?= $investigation->incidentDate()->toDate('d MMMM yyyy', $dateLocale) ?></time>
<?php endif ?>
<?php if ($investigation->chapo()->isNotEmpty()): ?>
<p class="description"><?= $investigation->chapo()->excerpt(200) ?></p>
<?php endif ?>
</div>
<button class="btn--go-to"><a href="<?= $investigation->url() ?>"><?= svg('assets/icons/arrow-left.svg') ?></a></button>
<a class="link-block" href="<?= $investigation->url() ?>" aria-hidden="true"></a>
</article>
<?php endforeach ?>
<div class="see-more">
<button class="btn--bold-inline">
<a href="/enquetes">
<span class="text"><?= t('investigations.see_all') ?></span>
<span class="icon"><?= svg('assets/icons/arrow-left.svg') ?></span>
</a>
</button>
</div>
</aside>
<?php endif ?>
</main>
2026-02-25 17:19:20 +01:00
<?php snippet('bottom-bar') ?>
2026-02-25 15:22:34 +01:00
<?php snippet('footer') ?>