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:
2025-07-09 16:18:46 +02:00
parent a851c8101b
commit 0080db66f5
2 changed files with 120 additions and 0 deletions
+63
View File
@@ -0,0 +1,63 @@
title: Block Page
columns:
main:
width: 2/3
sections:
content:
type: fields
fields:
blocks:
type: blocks
pretty: true
fieldsets:
- heading
- text
- image
- line
- gallery
- type: fen
label: FEN-Diagramm
preview: fields
wysiwyg: true
fields:
fen:
type: text
label: FEN-Position
- type: pgn4web
label: PGN-Datei
preview: fields
fields:
pgn:
label: PGN-Datei
type: files
sidebar:
width: 1/3
sections:
publishing:
type: fields
fields:
image:
label: Titelbild
type: files
headline:
label: Überschrift
type: text
subheadline:
label: Untertitel
type: text
summary:
label: Zusammenfassung
type: textarea
size: small
author:
label: Autor
type: users
default: true
date:
label: Datum
type: date
display: DD.MM.YYYY
default: today
+57
View File
@@ -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() ?>