#111405PageLinkBuilder: links to pages of another site no longer get config.extTarget
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
- 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).
- Set
config.extTarget = _blankin the TypoScript setup of site A. - 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 withparameter = t3://page?uid=2. - 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
-
Gerrit Code Review pushed patch set 1 for main to change 97544 status
NewUnder Review <span data-processor="relativetime" data-value="2026-11-11T14:36:47+00:00" > 11/11/26, 14:36 </span> -
Gerrit Code Review pushed patch set 1 for 14.3 to change 97563 <span data-processor="relativetime" data-value="2026-11-11T20:23:49+00:00" > 11/11/26, 20:23 </span>
-
Gerrit Code Review pushed patch set 2 for 14.3 to change 97563 <span data-processor="relativetime" data-value="2026-11-12T08:34:37+00:00" > 11/12/26, 08:34 </span>
-
Oliver Bartsch commented and changed status
Under ReviewResolved done0 %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.