From eb7cf4a9c680a65b93dc3123be41a1489b1cb7fd Mon Sep 17 00:00:00 2001 From: Silberengel Date: Thu, 30 Apr 2026 21:49:58 +0200 Subject: [PATCH] bug-fixes --- src/Controller/DefaultController.php | 1 - src/Service/MagazineContentService.php | 31 +++++++++++-------- src/Service/MagazineRefresher.php | 4 +++ .../HomeMagazineArticleStrip.html.twig | 13 ++------ templates/home.html.twig | 1 - 5 files changed, 25 insertions(+), 25 deletions(-) diff --git a/src/Controller/DefaultController.php b/src/Controller/DefaultController.php index 70675e8..b5fd960 100644 --- a/src/Controller/DefaultController.php +++ b/src/Controller/DefaultController.php @@ -28,7 +28,6 @@ class DefaultController extends AbstractController $magazineStrip = $this->magazineContent->buildHomeMagazineRootHeadlineStripData(); return $this->render('home.html.twig', [ - 'home_magazine_strip_heading' => $magazineStrip['heading'], 'home_magazine_strip_tiles' => $magazineStrip['tiles'], 'home_featured_tiles' => $this->magazineContent->buildHomeMixedFeaturedWallTiles($categoryATags), 'home_sidebar_category_recent' => $this->magazineContent->buildHomeSidebarCategorizedRecent($categoryATags), diff --git a/src/Service/MagazineContentService.php b/src/Service/MagazineContentService.php index f5e8560..f288b35 100644 --- a/src/Service/MagazineContentService.php +++ b/src/Service/MagazineContentService.php @@ -31,8 +31,9 @@ final class MagazineContentService } /** - * Category `a` tags from the persisted root only (no relay). The store is filled by - * `app:prewarm` / cron ({@see MagazineRefresher::refreshFromRelays}), not from HTTP. + * Kind **30040** child-index `a` tags from the persisted magazine root only (no relay). Long-form + * `a` tags on the same root event are excluded so they are not shown as header categories. + * The store is filled by `app:prewarm` / cron ({@see MagazineRefresher::refreshFromRelays}), not from HTTP. * * @return list> */ @@ -85,7 +86,15 @@ final class MagazineContentService if ($seq === null || !isset($seq[1]) || (string) $seq[1] === '') { continue; } - $cats[] = ['a', (string) $seq[1]]; + $coord = (string) $seq[1]; + $parts = explode(':', $coord, 3); + if (\count($parts) < 3) { + continue; + } + if ((int) ($parts[0] ?? 0) !== KindsEnum::PUBLICATION_INDEX->value) { + continue; + } + $cats[] = ['a', $coord]; } return $cats; @@ -711,9 +720,9 @@ final class MagazineContentService /** * Home headline strip: kind **30040** magazine root (`npub` + `d_tag`), walking `a` tags **top to bottom**. * Only kind **30023** / **30024** addresses become tiles; nested **30040** category `a` tags are skipped. - * Section heading comes from the root index `title` tag when present. + * No strip-level heading — each article’s own title in the template is enough. * - * @return array{heading: string, tiles: list} + * @return array{tiles: list} */ public function buildHomeMagazineRootHeadlineStripData(): array { @@ -725,10 +734,9 @@ final class MagazineContentService $mag = $this->store->getRoot($npub, $dTag); } if ($mag === null) { - return ['heading' => '', 'tiles' => []]; + return ['tiles' => []]; } - $heading = ''; $orderedCoords = []; $seenAddr = []; foreach ($mag->getTags() as $tagRow) { @@ -737,9 +745,6 @@ final class MagazineContentService continue; } $name = strtolower((string) ($seq[0] ?? '')); - if ($name === 'title' && isset($seq[1]) && trim((string) $seq[1]) !== '') { - $heading = trim((string) $seq[1]); - } if ($name !== 'a' || !isset($seq[1]) || (string) $seq[1] === '') { continue; } @@ -766,7 +771,7 @@ final class MagazineContentService } if ($orderedCoords === []) { - return ['heading' => $heading, 'tiles' => []]; + return ['tiles' => []]; } $pairsArg = []; @@ -804,10 +809,10 @@ final class MagazineContentService } if ($tiles === []) { - return ['heading' => $heading, 'tiles' => []]; + return ['tiles' => []]; } - return ['heading' => $heading, 'tiles' => $tiles]; + return ['tiles' => $tiles]; } /** diff --git a/src/Service/MagazineRefresher.php b/src/Service/MagazineRefresher.php index 0cb726b..8c4c06e 100644 --- a/src/Service/MagazineRefresher.php +++ b/src/Service/MagazineRefresher.php @@ -5,6 +5,7 @@ declare(strict_types=1); namespace App\Service; use App\Entity\Event; +use App\Enum\KindsEnum; use App\Util\NostrEventTags; use Psr\Cache\CacheItemPoolInterface; use Psr\Cache\InvalidArgumentException; @@ -202,6 +203,9 @@ final class MagazineRefresher if (\count($parts) < 3) { continue; } + if ((int) ($parts[0] ?? 0) !== KindsEnum::PUBLICATION_INDEX->value) { + continue; + } $s = trim((string) $parts[2]); if ($s !== '' && !\in_array($s, $slugs, true)) { $slugs[] = $s; diff --git a/templates/components/Organisms/HomeMagazineArticleStrip.html.twig b/templates/components/Organisms/HomeMagazineArticleStrip.html.twig index 48ab3b0..b4c84a8 100644 --- a/templates/components/Organisms/HomeMagazineArticleStrip.html.twig +++ b/templates/components/Organisms/HomeMagazineArticleStrip.html.twig @@ -1,19 +1,12 @@ {# - Home: magazine root kind 30040 — long-form `a` tags in index order (top to bottom). Section title from - root `title` tag. Same layout as before: illustration, headline, full article body (Markdown + highlights). + Home: magazine root kind 30040 — long-form `a` tags in index order. No strip-level heading; each + article uses its own title (h3). Same layout: illustration, headline, full body. #} {% if tiles is not empty %}
- {% if section_title|default('') != '' %} -

{{ section_title|e }}

- {% endif %}
{% for tile in tiles %} {% set item = tile.article %} diff --git a/templates/home.html.twig b/templates/home.html.twig index 65146c4..9016c82 100644 --- a/templates/home.html.twig +++ b/templates/home.html.twig @@ -43,7 +43,6 @@ {% if home_magazine_strip_tiles|default([]) is not empty %} {% include 'components/Organisms/HomeMagazineArticleStrip.html.twig' with { tiles: home_magazine_strip_tiles, - section_title: home_magazine_strip_heading|default(''), } only %} {% endif %} {% include 'components/Organisms/FeaturedWall.html.twig' with { tiles: home_featured_tiles|default([]) } only %}