Issue Bug Resolved

#111405PageLinkBuilder: links to pages of another site no longer get config.extTarget

Oliver Bartsch 11/11/26, 10:32 updated 11/14/26, 08:00

Description

Problem

A page link whose target page belongs to a different site (and therefore renders as an absolute URL with another host) is no longer treated as external.
@config.extTarget = _blank@ is not applied, the <a> tag has no target attribute. TYPO3 13.4 renders target="_blank" for the same link, 14.3.10 does not.

This is not covered by #110431: that fix passes the ContentObjectRenderer to resolveTargetAttribute(), but calculateTargetAttribute() is never called with
@$treatAsExternalLink = true@ for a cross-site page link, so extTarget is not read at all.

Steps to reproduce

  1. Set up two sites with different base URLs, e.g. https://site-a.example/ (root page 1) and https://site-b.example/ (root page 2).
  2. Set config.extTarget = _blank in the TypoScript setup of site A.
  3. On a page of site A render a link to a page of site B, e.g. <f:link.page pageUid="2">Site B</f:link.page> or a typolink with parameter = t3://page?uid=2.
  4. Expected (13.4): <a href="https://site-b.example/" target="_blank">. Actual (14.3.10): <a href="https://site-b.example/"> without target.

Cause

In 13.4 PageLinkBuilder::buildLink() started with $treatAsExternalLink = true and only reset it to false when the generated URL had no scheme/host or the
target page was on the same site (same root page id). In 14.3 buildLink() initializes $treatAsExternalLink = false. The block after
@generateUrlForPageWithSiteConfiguration()@ still only ever sets it to false, so the only remaining path to true is a link page (doktype 3). An absolute
URL to another site therefore falls through to the internal branch of calculateTargetAttribute() and gets target/@intTarget@ instead of extTarget.

Suggested fix

-                if ($currentSite && $currentSite->getRootPageId() === $siteOfTargetPage->getRootPageId()) {
-                    $treatAsExternalLink = false;
-                }
+                $treatAsExternalLink = !$currentSite || $currentSite->getRootPageId() !== $siteOfTargetPage->getRootPageId();

Reviews 2

History 14

  1. Oliver Bartsch commented and changed status Under Review Resolved done 0 % 100 % <span data-processor="relativetime" data-value="2026-11-14T08:00:18+00:00" > 11/14/26, 08:00 </span>

    Applied in changeset commit:d981abc4cf83dde57a626c688c181abc59d6dd04.