finish author system

This commit is contained in:
isUnknown 2024-10-16 08:53:53 +02:00
parent db8669d30d
commit fe6e01acdf
38 changed files with 614 additions and 73 deletions

View file

@ -1,16 +1,12 @@
<?php
$firstCol = rand(0, 8);
$secondCol = rand(0, 8)
$secondCol = rand(0, 8);
?>
<sidebar id="desktop-nav">
<ul>
<li
class="left top"
style="
--left: <?= e($page->fullWidth() != 'true', $firstCol, 0) ?>;
--top: <?= e($page->fullWidth() != 'true', rand(0, 6), 0) ?>
"
>
<button class="toggle-btn toggle-btn--left" onclick="togglePanel('left', event)">
années
@ -18,10 +14,6 @@
</li>
<li
class="left top"
style="
--left: <?= e($page->fullWidth() != 'true', $secondCol, 0) ?>;
--top: <?= e($page->fullWidth() != 'true', rand(0, 6), 0) ?>
"
>
<button class="toggle-btn toggle-btn--left" onclick="togglePanel('right', event)">
catégories
@ -31,10 +23,6 @@
"></li>
<li
class="left top"
style="
--left: <?= e($page->fullWidth() != 'true', $firstCol, 0) ?>;
--top: <?= e($page->fullWidth() != 'true', rand(0, 6), 0) ?>
"
>
<a href="#">
s'abonner
@ -42,10 +30,6 @@
</li>
<li
class="left top"
style="
--left: <?= e($page->fullWidth() != 'true', $secondCol, 0) ?>;
--top: <?= e($page->fullWidth() != 'true', rand(0, 6), 0) ?>
"
>
<a href="<?= $site->find('a-propos')->url() ?>">
à propos

View file

@ -24,7 +24,7 @@ $entryTopPos = $entryTopPos ?? 20;
"headline":"<?= $page->title() ?>",
"author":[{"@type": "Person","name": "<?= $page->author() ?>"}],
"image":"<?= url('assets/images/logo.png') ?>",
"description":"<?= $page->title() ?>, par <?= $page->author()->toUser()->name() ?>. Publié le <?= $page->published()->toDate('d/m/Y') ?> dans <?= $page->parent()->title() ?>/<?= $page->category() ?>",
"description":"<?= $page->title() ?>, par <?= $page->author()->toPage()->title() ?>. Publié le <?= $page->published()->toDate('d/m/Y') ?> dans <?= $page->parent()->title() ?>/<?= $page->category() ?>",
"datePublished":"<?= $page->published()->toDate('Y-m-d') ?>",
"dateModified":"<?= $page->modified('Y-m-d') ?>",
"url":"<?= $page->url() ?>",

View file

@ -52,14 +52,17 @@
>
<ul class="panel-item-content__texts">
<?php
shuffle($category['texts']);
$category['texts'];
foreach($category['texts'] as $article):
?>
<?php
$author = $article->author()->toPage() == null ? "inconnu" : $article->author()->toPage()->title();
?>
<li
class="text"
x-data="{
title: '<?= str_replace("'", "\'", $article->title()->value()) ?>',
author: '<?= $article->author()->toUser()->name() ?>',
author: '<?= $author ?>',
yearParent: '<?= $article->parent()->title()->value() ?>',
category: '<?= $article->category() ?>',
}"
@ -75,8 +78,7 @@
</a>
<div class="text__infos">
<p>
<span class="light">par</span>
<a class="author" href="/auteurs/<?= Str::slug($article->author()->toUser()->name()) ?>"><?= $article->author()->toUser()->name() ?></a><br>
<span class="light">par</span><a class="author" href="/auteurs/<?= Str::slug($author) ?>"><?= $author ?></a><br>
<span class="light">publié le </span><?= $article->published()->toDate('d/m/Y') ?><br>
<span class="light">dans</span> <a href="<?= $article->parent()->url() ?>"><?= $article->parent()->title() ?></a> / <a href="/categories/<?= $article->category() ?>"><?= $article->category() ?></a>
</p>

View file

@ -61,12 +61,15 @@
@click="edito = !edito"
>Lire</button>
<ul class="panel-item-content__texts">
<?php foreach($year->children()->shuffle() as $article): ?>
<?php foreach($year->children() as $article): ?>
<?php
$author = $article->author()->toPage() == null ? "inconnu" : $article->author()->toPage()->title();
?>
<li
class="text"
x-data="{
title: '<?= str_replace("'", "\'", $article->title()->value()) ?>',
author: '<?= $article->author()->toUser()->name() ?>',
author: '<?= $author ?>',
yearParent: '<?= $article->parent()->title()->value() ?>',
category: '<?= $article->category() ?>',
}"
@ -83,7 +86,7 @@
<div class="text__infos">
<p>
<span class="light">par</span>
<a class="author" href="/auteurs/<?= Str::slug($article->author()->toUser()->name()) ?>"><?= $article->author()->toUser()->name() ?></a><br>
<a class="author" href="/auteurs/<?= Str::slug($author) ?>"><?= $author ?></a><br>
<span class="light">publié le </span><?= $article->published()->toDate('d/m/Y') ?><br>
<span class="light">dans</span> <a href="<?= $article->parent()->url() ?>"><?= $article->parent()->title() ?></a> / <a href="/categories/<?= $article->category() ?>"><?= $article->category() ?></a>
</p>

View file

@ -66,7 +66,7 @@ $activeTab = isset($activeTab) ? Str::slug($activeTab) : '';
class="see-more toggle left" @click="isOpen = !isOpen">Lire</button>
</div>
<?php foreach($year->children() as $article): ?>
<?php if (!$authorFilter || $authorFilter == $article->author()->toUser()->name()->value()) : ?>
<?php if (!$authorFilter || $authorFilter == $article->author()->toPage()->title()->value()) : ?>
<?php snippet(
'text-item',
array(

View file

@ -7,7 +7,7 @@
<div class="text__infos">
<p>
<span class="light">par</span>
<a class="author" href="/auteurs/<?= Str::slug($article->author()->toUser()->name()) ?>"><?= $article->author()->toUser()->name() ?></a><br>
<a class="author" href="/auteurs/<?= Str::slug($article->author()->toPage()->title()) ?>"><?= $article->author()->toPage()->title() ?></a><br>
<span class="light">publié le </span><?= $article->published()->toDate('d/m/Y') ?><br>
<span class="light">dans</span> <a href="<?= $article->parent()->url() ?>"><?= $article->parent()->title() ?></a> / <a href="/categories/<?= $article->category() ?>"><?= $article->category() ?></a>
</p>