feat: introduce news section with blueprint and template
Added a new `news.yml` blueprint and `news.php` template to create a dedicated news section. Integrated structured content with support for various block types, including FEN and PGN formats. Enhanced layout with author details, publication date, and customizable headlines.
This commit is contained in:
@@ -0,0 +1,57 @@
|
||||
<?php
|
||||
// FEN in Array umwandeln
|
||||
function fenToBoard($fen) {
|
||||
$rows = explode('/', explode(' ', $fen)[0]);
|
||||
$board = [];
|
||||
foreach ($rows as $row) {
|
||||
$boardRow = [];
|
||||
$chars = str_split($row);
|
||||
foreach ($chars as $char) {
|
||||
if (is_numeric($char)) {
|
||||
for ($i = 0; $i < intval($char); $i++) {
|
||||
$boardRow[] = '';
|
||||
}
|
||||
} else {
|
||||
$boardRow[] = $char;
|
||||
}
|
||||
}
|
||||
$board[] = $boardRow;
|
||||
}
|
||||
|
||||
return $board;
|
||||
}?>
|
||||
|
||||
|
||||
<?php snippet('layout', slots: true) ?>
|
||||
<p><?= $page->date()->toDate("d.m.Y") ?> - <?= $page->subheadline() ?></p>
|
||||
|
||||
<h1><?= $page->headline() ?></h1>
|
||||
|
||||
<div>
|
||||
<img src="<?= $page->image()->url() ?>" alt="">
|
||||
</div>
|
||||
|
||||
<div class="blockpage">
|
||||
<?= $page->blocks()->toBlocks() ?>
|
||||
</div>
|
||||
|
||||
<?php if ($user = $page->author()->toUser()): ?>
|
||||
<div class="mt-6 flex border-t border-b-sf_grau-300 pt-6">
|
||||
<div class="relative flex items-center gap-x-4">
|
||||
<img src="<?= $user->avatar()->url() ?>" alt="" class="size-10 rounded-full" />
|
||||
<div class="text-sm/6">
|
||||
<p>
|
||||
<a href="#">
|
||||
<span class="absolute inset-0"></span>
|
||||
<div class="text-xl">
|
||||
<?= $user->username() ?>
|
||||
</div>
|
||||
</a>
|
||||
</p>
|
||||
<p class="text-sm"><?= $user->role()->title() ?></p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif ?>
|
||||
|
||||
<?php endsnippet() ?>
|
||||
Reference in New Issue
Block a user