web: Doppelveröffentlichung — Prüfsumme, kanonische Zuordnung (aus bis E9), Quellenauskunft, noindex im Portal (Anhang 2)
Über die API kommt praktisch jede Meldung zweimal, je Portal eine Zeile mit gleichem Text: 9.092 Paare, 53 % des Archivs, bisher jede Fassung self-canonical und in beiden Sitemaps — Google wählte. 1c.7: press_releases.content_hash (SHA-256 über Titel + Text ohne Markup), gesetzt beim Speichern, Bestand per press-releases:hash-content (Query-Builder, Blöcke). Migration in zwei Statements — ADD COLUMN INSTANT, ADD INDEX INPLACE, kein Rebuild. press-releases:duplicates-report zählt Paare je Hauptkategorie. 1c.8: canonical_press_release_id + CanonicalAssigner. Erstquelle folgt der Kategorie (config/canonical.php, Vorschlag zu E9), sonst die zuerst veröffentlichte Fassung. Zuordnung bei jeder Veröffentlichung und über den Bestand (press-releases:assign-canonicals). Die Kopie trägt rel=canonical und mainEntityOfPage auf die Erstquelle; Sitemap und News-Sitemap nennen nur sie; Leser sehen weiterhin beide. Alles hinter CANONICAL_ASSIGNMENT_ENABLED (false), bis E9 entschieden ist. 1c.9: user_canonical in den Index-Prüfungen, sourceVerdict() unterscheidet eigene Adresse / andere eigene Fassung / fremdes Portal; Anzeige im Block „Google-Index" hinter GSC_CUSTOMER_VISIBLE, ohne Aussage über das Warum. Dazu: Abschnitt zur einen Quelle auf /gute-pressemitteilung (Verteiler → viele Kopien, eigene Website zuerst, keine Garantie), noindex in Admin-, Kunden- und Auth-Layouts, UmamiSnippetTest von der lokalen .env gelöst. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
447dc4c61e
commit
ee267c622e
28 changed files with 1231 additions and 11 deletions
|
|
@ -6,6 +6,7 @@ use App\Http\Controllers\Controller;
|
|||
use App\Http\Middleware\SetEdition;
|
||||
use App\Models\PressRelease;
|
||||
use App\Scopes\PortalScope;
|
||||
use App\Services\PressRelease\CanonicalAssigner;
|
||||
use App\Support\StructuredData;
|
||||
use App\Support\WebPortalContext;
|
||||
use Illuminate\Http\Request;
|
||||
|
|
@ -50,18 +51,26 @@ class NewsSitemapController extends Controller
|
|||
$context = WebPortalContext::fromRequest();
|
||||
$publication = (string) StructuredData::publisher($base)['name'];
|
||||
|
||||
// Bei Doppelveröffentlichung nur die Erstquelle (Anhang 2, 1c.8) —
|
||||
// Google News spielt ohnehin nur eine Fassung aus.
|
||||
$assigner = app(CanonicalAssigner::class);
|
||||
$releases = PressRelease::query()
|
||||
->withoutGlobalScope(PortalScope::class)
|
||||
->visibleInArchive()
|
||||
->forPortalValues($context->portalValues)
|
||||
->when($assigner->enabled(), fn ($query) => $query->whereNull('canonical_press_release_id'))
|
||||
->where('published_at', '>=', now()->subHours(self::WINDOW_HOURS))
|
||||
->orderByDesc('published_at')
|
||||
->limit(self::MAX_URLS)
|
||||
->get(['slug', 'title', 'language', 'published_at']);
|
||||
->get(['id', 'slug', 'title', 'portal', 'language', 'category_id', 'canonical_press_release_id', 'published_at']);
|
||||
|
||||
$entries = [];
|
||||
|
||||
foreach ($releases as $release) {
|
||||
if (! $assigner->isCanonicalOn($release, $context->portal)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$edition = in_array($release->language, SetEdition::EDITIONS, true) ? $release->language : SetEdition::DEFAULT_EDITION;
|
||||
|
||||
$entries[] = [
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ use App\Models\Category;
|
|||
use App\Models\Company;
|
||||
use App\Models\PressRelease;
|
||||
use App\Scopes\PortalScope;
|
||||
use App\Services\PressRelease\CanonicalAssigner;
|
||||
use App\Services\Web\CategoryArchivePageData;
|
||||
use App\Support\WebPortalContext;
|
||||
use Illuminate\Http\Request;
|
||||
|
|
@ -120,15 +121,23 @@ class SitemapController extends Controller
|
|||
];
|
||||
}
|
||||
|
||||
// Alle im Archiv sichtbaren Pressemitteilungen des Portals.
|
||||
// Alle im Archiv sichtbaren Pressemitteilungen des Portals — bei
|
||||
// Doppelveröffentlichung nur die Erstquelle (Anhang 2, 1c.8): eine
|
||||
// Sitemap soll nur kanonische Adressen nennen.
|
||||
$assigner = app(CanonicalAssigner::class);
|
||||
$releases = PressRelease::query()
|
||||
->withoutGlobalScope(PortalScope::class)
|
||||
->visibleInArchive()
|
||||
->forPortalValues($context->portalValues)
|
||||
->when($assigner->enabled(), fn ($query) => $query->whereNull('canonical_press_release_id'))
|
||||
->orderByDesc('published_at')
|
||||
->get(['slug', 'published_at', 'updated_at']);
|
||||
->get(['id', 'slug', 'portal', 'language', 'category_id', 'canonical_press_release_id', 'published_at', 'updated_at']);
|
||||
|
||||
foreach ($releases as $release) {
|
||||
if (! $assigner->isCanonicalOn($release, $context->portal)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$urls[] = [
|
||||
'loc' => $base.'/de/press-release/'.$release->slug,
|
||||
'lastmod' => ($release->updated_at ?? $release->published_at)?->toAtomString(),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue