You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When a child page is linked using the [sitetree_link] shortcode and it's parent is unpublished, the link looses all references to the parent page(s) URL structure and country suffix in base URL, instead appending the ?l= parameter to the link.
For a linked page located at example.com/uk/root-page/subpage/, if root-page is unpublished, the link output by the shortcode (calling $page->Link()) becomes example.com/subpage/?l=en_GB.
This issue causes problems for legacy context, for example when implementing redirects for unpublished/archived pages linked in many content areas like blog posts etc.
A temp fix is to re-register the link_shortcode_handler on an extended SiteTree model to walk the parent tree instead, building the link manually from last known version:
The issue isn't if the page can be navigated to or not, in the above circumstance both would still return a 404. The issue is about maintaining the link formatting.
In one example it would make it easier to implement redirects. If a page is linked to on say 100+ blog posts, a new version of that page is created elsewhere and a redirect middleware / htaccess was being used to handle this, when one of the parents are unpublished for the old page all prior redirects won't have effect any longer; the fluent base url is removed along with the parent tree context.
Two separate pages with the same URL segment under different unpublished parents even render the same (albeit broken) link, it makes it near impossible to manage legacy context, though I understand this may be a wider scope than fluent.
When a child page is linked using the
[sitetree_link]
shortcode and it's parent is unpublished, the link looses all references to the parent page(s) URL structure and country suffix in base URL, instead appending the?l=
parameter to the link.For a linked page located at
example.com/uk/root-page/subpage/
, ifroot-page
is unpublished, the link output by the shortcode (calling$page->Link()
) becomesexample.com/subpage/?l=en_GB
.This issue causes problems for legacy context, for example when implementing redirects for unpublished/archived pages linked in many content areas like blog posts etc.
A temp fix is to re-register the
link_shortcode_handler
on an extended SiteTree model to walk the parent tree instead, building the link manually from last known version:The text was updated successfully, but these errors were encountered: