add author page
This commit is contained in:
parent
2114fbbb8e
commit
f9397935bd
4 changed files with 26 additions and 18 deletions
|
|
@ -49,7 +49,7 @@ return [
|
||||||
],
|
],
|
||||||
'routes' => [
|
'routes' => [
|
||||||
[
|
[
|
||||||
'pattern' => 'auteur/(:any)',
|
'pattern' => 'auteurs/(:any)',
|
||||||
'action' => function ($slug) {
|
'action' => function ($slug) {
|
||||||
$kirby = kirby();
|
$kirby = kirby();
|
||||||
$author = getAuthorBySlug($slug);
|
$author = getAuthorBySlug($slug);
|
||||||
|
|
@ -61,6 +61,7 @@ return [
|
||||||
'content' => [
|
'content' => [
|
||||||
'title' => $author->name(),
|
'title' => $author->name(),
|
||||||
'presentation' => $author->presentation(),
|
'presentation' => $author->presentation(),
|
||||||
|
'author' => $author->name(),
|
||||||
'uuid' => Uuid::generate(),
|
'uuid' => Uuid::generate(),
|
||||||
]
|
]
|
||||||
]);
|
]);
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
$left['slug'] = Str::slug($left['label']);
|
$left['slug'] = Str::slug($left['label']);
|
||||||
|
$authorFilter = isset($authorFilter) ? $authorFilter : false;
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<div id="tabs" x-data="{
|
<div id="tabs" x-data="{
|
||||||
|
|
@ -31,21 +32,26 @@ $left['slug'] = Str::slug($left['label']);
|
||||||
<h3 class="fs-xl color" style="--color:var(--color-secondary)"><?= $year->title() ?></h3>
|
<h3 class="fs-xl color" style="--color:var(--color-secondary)"><?= $year->title() ?></h3>
|
||||||
</div>
|
</div>
|
||||||
<?php foreach($year->children() as $article): ?>
|
<?php foreach($year->children() as $article): ?>
|
||||||
<li class="article | bottom" style="--bottom:3">
|
<?php if (!$authorFilter || $authorFilter == $article->author()->toUser()->name()->value()) : ?>
|
||||||
<a href="<?= $article->url() ?>" class="article__title no-line">
|
<li class="article | bottom" style="--bottom:3">
|
||||||
<h3><?= $article->title() ?></h3>
|
<a href="<?= $article->url() ?>" class="article__title no-line">
|
||||||
</a>
|
<h3><?= $article->title() ?></h3>
|
||||||
<div class="article__infos">
|
</a>
|
||||||
<p>
|
<div class="article__infos">
|
||||||
<span class="opacity" style="--opacity:.5">Par</span>
|
<p>
|
||||||
<a class="author no-line" href="#"><?= $article->author()->toUser()->name() ?></a>,
|
<?php if (!$authorFilter): ?>
|
||||||
<span class="opacity" style="--opacity:.5">le</span> <?= $article->published()->toDate('d/m/Y') ?>
|
<span class="opacity" style="--opacity:.5">par</span>
|
||||||
</p>
|
<a class="author no-line" href="/auteurs/<?= Str::slug($article->author()->toUser()->name()) ?>"><?= $article->author()->toUser()->name() ?></a>,
|
||||||
</div>
|
<span class="opacity" style="--opacity:.5">le</span>
|
||||||
<!-- <div class="article__labels">
|
<?php endif ?>
|
||||||
<button class="label label--category">[ <?= $article->category() ?> ]</button>
|
<?= $article->published()->toDate('d/m/Y') ?>
|
||||||
</div> -->
|
</p>
|
||||||
</li>
|
</div>
|
||||||
|
<!-- <div class="article__labels">
|
||||||
|
<button class="label label--category">[ <?= $article->category() ?> ]</button>
|
||||||
|
</div> -->
|
||||||
|
</li>
|
||||||
|
<?php endif ?>
|
||||||
<?php endforeach ?>
|
<?php endforeach ?>
|
||||||
<?php endforeach ?>
|
<?php endforeach ?>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,8 @@
|
||||||
'left' => [
|
'left' => [
|
||||||
'label' => 'Présentation',
|
'label' => 'Présentation',
|
||||||
'content' => $page->presentation()
|
'content' => $page->presentation()
|
||||||
]
|
],
|
||||||
|
'authorFilter' => $page->author()
|
||||||
]) ?>
|
]) ?>
|
||||||
</article>
|
</article>
|
||||||
</main>
|
</main>
|
||||||
|
|
@ -11,7 +11,7 @@
|
||||||
<article>
|
<article>
|
||||||
<div class="article-header">
|
<div class="article-header">
|
||||||
<h1 class="main-title title-center <?= setTitleFontSizeClass($page->title()) ?>"><?= $page->title() ?></h1>
|
<h1 class="main-title title-center <?= setTitleFontSizeClass($page->title()) ?>"><?= $page->title() ?></h1>
|
||||||
<p>Par <a href="/auteur/<?= Str::slug($page->author()->toUser()->name()) ?>" title="Voir les articles d'<?= $page->author()->toUser()->name() ?>"><?= $page->author()->toUser()->name() ?></a></p>
|
<p><span class="opacity" style="--opacity:.5">par</span> <a class="author no-line" href="/auteurs/<?= Str::slug($page->author()->toUser()->name()) ?>" title="Voir les articles d'<?= $page->author()->toUser()->name() ?>"><?= $page->author()->toUser()->name() ?></a></p>
|
||||||
</div>
|
</div>
|
||||||
<?php snippet('tabs', [
|
<?php snippet('tabs', [
|
||||||
'left' => [
|
'left' => [
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue