Verlinkung & Backlinks: systemseitige rel-Auszeichnung (Decision-Update 11.06.)
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
parent
5a8da0c1f4
commit
25ea91d85b
8 changed files with 239 additions and 3 deletions
|
|
@ -123,3 +123,49 @@ test('PressRelease::renderedText uses the sanitizer', function () {
|
|||
expect($rendered)->toContain('<p>Hallo</p>');
|
||||
expect($rendered)->not->toContain('<script');
|
||||
});
|
||||
|
||||
// ============================================================
|
||||
// Link-Policy (Decision-Update „Verlinkung & Backlinks", 11.06.2026)
|
||||
// ============================================================
|
||||
|
||||
test('rendered external links carry sponsored nofollow noopener', function () {
|
||||
$html = (string) sanitizer()->render('<p><a href="https://kundenseite.example/produkt">Produkt</a></p>');
|
||||
|
||||
expect($html)->toContain('rel="sponsored nofollow noopener"')
|
||||
->and($html)->toContain('target="_blank"');
|
||||
});
|
||||
|
||||
test('rendered internal portal links stay follow', function () {
|
||||
$html = (string) sanitizer()->render('<p><a href="https://presseecho.test/firma/alpha-gmbh">Unternehmensprofil</a></p>');
|
||||
|
||||
expect($html)->not->toContain('nofollow')
|
||||
->and($html)->not->toContain('sponsored')
|
||||
->and($html)->toContain('href="https://presseecho.test/firma/alpha-gmbh"');
|
||||
});
|
||||
|
||||
test('relative links are treated as internal and stay follow', function () {
|
||||
$html = (string) sanitizer()->render('<p><a href="/firma/alpha-gmbh">Profil</a></p>');
|
||||
|
||||
expect($html)->not->toContain('nofollow')
|
||||
->and($html)->not->toContain('target=');
|
||||
});
|
||||
|
||||
test('author-supplied rel attributes are always overridden', function () {
|
||||
$html = (string) sanitizer()->render('<p><a href="https://kundenseite.example" rel="dofollow">Link</a></p>');
|
||||
|
||||
expect($html)->not->toContain('dofollow')
|
||||
->and($html)->toContain('rel="sponsored nofollow noopener"');
|
||||
});
|
||||
|
||||
test('mailto and tel links get no rel and no target', function () {
|
||||
$html = (string) sanitizer()->render('<p><a href="mailto:presse@example.test">Mail</a></p>');
|
||||
|
||||
expect($html)->not->toContain('rel=')
|
||||
->and($html)->not->toContain('target=');
|
||||
});
|
||||
|
||||
test('www variants of portal domains count as internal', function () {
|
||||
$html = (string) sanitizer()->render('<p><a href="https://www.presseecho.test/firma/alpha">Profil</a></p>');
|
||||
|
||||
expect($html)->not->toContain('nofollow');
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue