WS-1: Canonical- & OpenGraph-Meta zentral im Web-Layout

Ergänzt web-master.blade.php um <link rel="canonical">, OpenGraph- und
Twitter-Card-Tags. Self-Canonical-Default wird portal-getrennt aus der
Portal-URL ($domainUrl) + Request-Pfad gebaut – bewusst nicht aus
url()->current(), da URL::forceRootUrl sonst alle Portale fälschlich auf
pressekonto.test kanonisieren würde. Seiten können canonical/meta_description/
og_type/og_image per @section überschreiben; release-detail als article
ausgezeichnet. Erfüllt die Canonical-Hygiene aus dem Duplicate-Content-Update §5.

Tests: tests/Feature/Web/CanonicalMetaTest.php (inkl. Cross-Portal-Negativtest).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Kevin Adametz 2026-06-15 10:03:15 +00:00
parent ce5d6c98e1
commit e54f6e2552
3 changed files with 63 additions and 2 deletions

View file

@ -0,0 +1,29 @@
<?php
use Tests\TestCase;
test('the release detail page emits an article canonical from its slug', function () {
/** @var TestCase $this */
$this->get('https://businessportal24.test/release/ki-revolution')
->assertSuccessful()
->assertSee('<link rel="canonical" href="', false)
->assertSee('/release/ki-revolution', false)
->assertSee('<meta property="og:type" content="article">', false)
->assertSee('<meta property="og:url" content="', false);
});
test('a portal homepage emits a self-referencing canonical for its own domain', function () {
/** @var TestCase $this */
$this->get('https://businessportal24.test/')
->assertSuccessful()
->assertSee('<link rel="canonical" href="https://businessportal24.test', false)
->assertSee('<meta property="og:site_name" content="', false);
});
test('portals stay self-canonical on their own host, never cross-portal', function () {
/** @var TestCase $this */
$this->get('https://presseecho.test/')
->assertSuccessful()
->assertSee('<link rel="canonical" href="https://presseecho.test', false)
->assertDontSee('businessportal24.test', false);
});